+13
-15
lines changedFilter options
+13
-15
lines changed Original file line number Diff line number Diff line change
@@ -1458,17 +1458,17 @@ extract_completion_items({result})
1458
1458
https://microsoft.github.io/language-server-protocol/specification#textDocument_completion
1459
1459
1460
1460
get_effective_tabstop({bufnr}) *vim.lsp.util.get_effective_tabstop()*
1461
-
Returns visual width of tabstop.
1461
+
Returns indentation size.
1462
1462
1463
1463
Parameters: ~
1464
1464
{bufnr} (optional, number): Buffer handle, defaults to
1465
1465
current
1466
1466
1467
1467
Return: ~
1468
-
(number) tabstop visual width
1468
+
(number) indentation size
1469
1469
1470
1470
See also: ~
1471
-
|softtabstop|
1471
+
|shiftwidth|
1472
1472
1473
1473
*vim.lsp.util.jump_to_location()*
1474
1474
jump_to_location({location}, {offset_encoding})
Original file line number Diff line number Diff line change
@@ -1894,16 +1894,16 @@ end
1894
1894
function M.make_workspace_params(added, removed)
1895
1895
return { event = { added = added; removed = removed; } }
1896
1896
end
1897
-
--- Returns visual width of tabstop.
1897
+
--- Returns indentation size.
1898
1898
---
1899
-
---@see |softtabstop|
1899
+
---@see |shiftwidth|
1900
1900
---@param bufnr (optional, number): Buffer handle, defaults to current
1901
-
---@returns (number) tabstop visual width
1901
+
---@returns (number) indentation size
1902
1902
function M.get_effective_tabstop(bufnr)
1903
1903
validate { bufnr = {bufnr, 'n', true} }
1904
1904
local bo = bufnr and vim.bo[bufnr] or vim.bo
1905
-
local sts = bo.softtabstop
1906
-
return (sts > 0 and sts) or (sts < 0 and bo.shiftwidth) or bo.tabstop
1905
+
local sw = bo.shiftwidth
1906
+
return (sw == 0 and bo.tabstop) or sw
1907
1907
end
1908
1908
1909
1909
--- Creates a `DocumentFormattingParams` object for the current buffer and cursor position.
Original file line number Diff line number Diff line change
@@ -2374,18 +2374,16 @@ describe('LSP', function()
2374
2374
end)
2375
2375
2376
2376
describe('lsp.util.get_effective_tabstop', function()
2377
-
local function test_tabstop(tabsize, softtabstop)
2377
+
local function test_tabstop(tabsize, shiftwidth)
2378
2378
exec_lua(string.format([[
2379
-
vim.api.nvim_buf_set_option(0, 'softtabstop', %d)
2379
+
vim.api.nvim_buf_set_option(0, 'shiftwidth', %d)
2380
2380
vim.api.nvim_buf_set_option(0, 'tabstop', 2)
2381
-
vim.api.nvim_buf_set_option(0, 'shiftwidth', 3)
2382
-
]], softtabstop))
2381
+
]], shiftwidth))
2383
2382
eq(tabsize, exec_lua('return vim.lsp.util.get_effective_tabstop()'))
2384
2383
end
2385
2384
2386
-
it('with softtabstop = 1', function() test_tabstop(1, 1) end)
2387
-
it('with softtabstop = 0', function() test_tabstop(2, 0) end)
2388
-
it('with softtabstop = -1', function() test_tabstop(3, -1) end)
2385
+
it('with shiftwidth = 1', function() test_tabstop(1, 1) end)
2386
+
it('with shiftwidth = 0', function() test_tabstop(2, 0) end)
2389
2387
end)
2390
2388
2391
2389
describe('vim.lsp.buf.outgoing_calls', function()
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4