diff options
author | Mathias Fußenegger <mfussenegger@users.noreply.github.com> | 2023-02-23 13:35:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-23 13:35:46 +0100 |
commit | f140175564001cc1ad84128a0147a5d2f7798a63 (patch) | |
tree | 2fd37f8e01b944d1f9c734d78123c8d0b749b94b /runtime/lua/vim | |
parent | 0cd0fdf4788b892a85c196b26a4099ae2e86beff (diff) | |
download | rneovim-f140175564001cc1ad84128a0147a5d2f7798a63.tar.gz rneovim-f140175564001cc1ad84128a0147a5d2f7798a63.tar.bz2 rneovim-f140175564001cc1ad84128a0147a5d2f7798a63.zip |
refactor(lsp): remove workaround for missing bit module (#22373)
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r-- | runtime/lua/vim/lsp/semantic_tokens.lua | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/runtime/lua/vim/lsp/semantic_tokens.lua b/runtime/lua/vim/lsp/semantic_tokens.lua index b1bc48dac6..00b4757ea9 100644 --- a/runtime/lua/vim/lsp/semantic_tokens.lua +++ b/runtime/lua/vim/lsp/semantic_tokens.lua @@ -1,6 +1,7 @@ local api = vim.api local handlers = require('vim.lsp.handlers') local util = require('vim.lsp.util') +local bit = require('bit') --- @class STTokenRange --- @field line number line number 0-based @@ -58,18 +59,10 @@ local function modifiers_from_number(x, modifiers_table) local modifiers = {} local idx = 1 while x > 0 do - if _G.bit then - if _G.bit.band(x, 1) == 1 then - modifiers[#modifiers + 1] = modifiers_table[idx] - end - x = _G.bit.rshift(x, 1) - else - --TODO(jdrouhard): remove this branch once `bit` module is available for non-LuaJIT (#21222) - if x % 2 == 1 then - modifiers[#modifiers + 1] = modifiers_table[idx] - end - x = math.floor(x / 2) + if bit.band(x, 1) == 1 then + modifiers[#modifiers + 1] = modifiers_table[idx] end + x = bit.rshift(x, 1) idx = idx + 1 end |