Skip to content

Commit 4958194

Browse files
committed
fix: added global position encoding
1 parent 161310a commit 4958194

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

lua/plugins/config/lsp/init.lua

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,28 @@ local M = {}
33

44
function M.setup()
55
local lspconfig = require 'lspconfig'
6-
6+
77
-- Get capabilities from blink.cmp if available
88
local capabilities = {}
99
pcall(function()
1010
capabilities = require('blink.cmp').get_lsp_capabilities()
1111
end)
12-
12+
--
13+
-- Set global position encoding preference
14+
capabilities.offsetEncoding = { 'utf-8', 'utf-16' }
15+
1316
-- Load server configurations
1417
local servers = require('plugins.config.lsp.servers').get_servers()
15-
18+
1619
-- Setup each server with capabilities
1720
for name, config in pairs(servers) do
1821
config.capabilities = vim.tbl_deep_extend('force', {}, capabilities, config.capabilities or {})
1922
lspconfig[name].setup(config)
2023
end
21-
24+
2225
-- Setup LSP keymaps
2326
require('plugins.config.lsp.keymaps').setup()
2427
end
2528

26-
return M
29+
return M
30+

lua/plugins/config/lsp/servers.lua

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ local util = require 'lspconfig.util'
66
-- Get clang-wrapper resource-root for Nix environments
77
local function get_clang_resource_dir()
88
-- Try to find clang-wrapper's resource-root
9-
local handle = io.popen('ls -d /nix/store/*clang-wrapper*/resource-root 2>/dev/null | head -1')
9+
local handle = io.popen 'ls -d /nix/store/*clang-wrapper*/resource-root 2>/dev/null | head -1'
1010
if handle then
11-
local resource_root = handle:read('*l')
11+
local resource_root = handle:read '*l'
1212
handle:close()
1313
if resource_root and resource_root ~= '' then
1414
return resource_root
1515
end
1616
end
17-
return nil -- Let clangd use its default
17+
return nil -- Let clangd use its default
1818
end
1919

2020
function M.get_servers()
@@ -30,7 +30,7 @@ function M.get_servers()
3030
'--header-insertion-decorators',
3131
'--header-insertion=iwyu',
3232
}
33-
33+
3434
-- Add resource-dir if in Nix environment
3535
local resource_dir = get_clang_resource_dir()
3636
if resource_dir then
@@ -72,7 +72,6 @@ function M.get_servers()
7272
},
7373
},
7474
},
75-
positionEncoding = 'utf-8',
7675
},
7776

7877
-- Python Linter/Formatter
@@ -106,4 +105,3 @@ function M.get_servers()
106105
end
107106

108107
return M
109-

0 commit comments

Comments
 (0)