diff --git a/changelog.md b/changelog.md index b500a77..7ad3524 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,7 @@ ### Features +* Support highlighting references to the symbol under the cursor in the current scope. * Support loading external docsets from disk. * Extract TIC-80 docs to external docset. * Support `:lua-version` settings like `"lua5.4"` rather than requiring `"lua54"`. diff --git a/src/fennel-ls/handlers.fnl b/src/fennel-ls/handlers.fnl index 1c62619..74e0f59 100644 --- a/src/fennel-ls/handlers.fnl +++ b/src/fennel-ls/handlers.fnl @@ -103,10 +103,10 @@ Every time the client sends a message, it gets handled by a function in the corr :textDocument {: uri}}] (let [this-file (files.get-by-uri server uri) byte (utils.position->byte this-file.text position server.position-encoding)] - (case-try (analyzer.find-symbol this-file.ast byte) + (match-try (analyzer.find-symbol this-file.ast byte) symbol (analyzer.find-nearest-definition server this-file symbol byte) - (where {: referenced-by : file : binding} (= file.uri uri)) + {: referenced-by :file {:uri this-file.uri &as file} : binding} (let [result (icollect [_ {:symbol reference} (ipairs referenced-by)] {:range (message.ast->range server file reference) :kind documentHighlightKind.Read})]