diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-09-27 17:18:38 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-27 17:18:38 +0800 |
commit | e462ad0bc5254487337daf285c0303b0eb93e607 (patch) | |
tree | ef11d0d548e23a18da5151321e614d3dca07f797 /script/proto | |
parent | 98c74b1f9a04ed49e4c9186e9e01f7c5c15449c9 (diff) | |
parent | 4c51da51064bb825563827d0610a1e3db75299aa (diff) | |
download | lua-language-server-e462ad0bc5254487337daf285c0303b0eb93e607.zip |
Merge pull request #689 from ArcanoxDragon/improve-semantic-highlighting
Improve diversity and granularity of semantic token highlighting
Diffstat (limited to 'script/proto')
-rw-r--r-- | script/proto/converter.lua | 10 | ||||
-rw-r--r-- | script/proto/define.lua | 15 |
2 files changed, 18 insertions, 7 deletions
diff --git a/script/proto/converter.lua b/script/proto/converter.lua index 19d592fe..da0442fe 100644 --- a/script/proto/converter.lua +++ b/script/proto/converter.lua @@ -12,7 +12,15 @@ local function rawPackPosition(uri, pos) local text = files.getText(uri) if text then local lineOffset = state.lines[row] - col = utf8.len(text, lineOffset, lineOffset + col - 1, true) + if lineOffset then + local start = lineOffset + local finish = lineOffset + col - 1 + if start <= #text and finish <= #text then + col = utf8.len(text, lineOffset, lineOffset + col - 1, true) + end + else + col = 0 + end end end return { diff --git a/script/proto/define.lua b/script/proto/define.lua index 8ee63821..fa351abb 100644 --- a/script/proto/define.lua +++ b/script/proto/define.lua @@ -207,12 +207,14 @@ m.SymbolKind = { } m.TokenModifiers = { - ["declaration"] = 1 << 0, - ["documentation"] = 1 << 1, - ["static"] = 1 << 2, - ["abstract"] = 1 << 3, - ["deprecated"] = 1 << 4, - ["readonly"] = 1 << 5, + ["declaration"] = 1 << 0, + ["documentation"] = 1 << 1, + ["static"] = 1 << 2, + ["abstract"] = 1 << 3, + ["deprecated"] = 1 << 4, + ["readonly"] = 1 << 5, + ["defaultLibrary"] = 1 << 6, + ["local"] = 1 << 7, } m.TokenTypes = { @@ -235,6 +237,7 @@ m.TokenTypes = { ["parameter"] = 16, ["property"] = 17, ["label"] = 18, + ["method"] = 19, } m.BuiltIn = { |