diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-11-16 01:39:01 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-11-16 01:39:01 +0800 |
commit | f2c235601da54117b803e084d94bbf88ba53b891 (patch) | |
tree | 53a5da83000c2f862357fe2b137dea335821cb45 /server-beta/src/provider/init.lua | |
parent | 333a10fd656b48a063092127c610348d861c2f74 (diff) | |
download | lua-language-server-f2c235601da54117b803e084d94bbf88ba53b891.zip |
实现高亮
Diffstat (limited to 'server-beta/src/provider/init.lua')
-rw-r--r-- | server-beta/src/provider/init.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/server-beta/src/provider/init.lua b/server-beta/src/provider/init.lua index 5e1a1a2a..0a70763e 100644 --- a/server-beta/src/provider/init.lua +++ b/server-beta/src/provider/init.lua @@ -207,6 +207,29 @@ proto.on('textDocument/references', function (params) return response end) +proto.on('textDocument/documentHighlight', function (params) + local core = require 'core.highlight' + local uri = params.textDocument.uri + if not files.exists(uri) then + return nil + end + local lines = files.getLines(uri) + local text = files.getText(uri) + local offset = define.offset(lines, text, params.position) + local result = core(uri, offset) + if not result then + return nil + end + local response = {} + for _, info in ipairs(result) do + response[#response+1] = { + range = define.range(lines, text, info.start, info.finish), + kind = info.kind, + } + end + return response +end) + proto.on('textDocument/completion', function (params) --log.info(util.dump(params)) return nil |