Closed dunric closed 7 months ago
GoSameIds will correctly calculate starting & ending positions for a selected identifier(token) and highligh appropriately.
GoSameIds
end position of an identifier is lesser off by 1, when identifier immediately precedes End-Of-Line character:
See non-highlighted t of lst identifier on 65th (64th when zero-indexed) row.
t
lst
Bellow is a tracing output from sameIDsHandler function. Notice ending position on 64th row is 12 instead of 13.
end
{'uri': 'file:///home/dunric/Projects/Go/playground/lib/algorithms.go', 'range': {'end': {'character': 33, 'line': 59}, 'start': {'character': 30, 'line': 59}}} {'uri': 'file:///home/dunric/Projects/Go/playground/lib/algorithms.go', 'range': {'end': {'character': 11, 'line': 63}, 'start': {'character': 8, 'line': 63}}} {'uri': 'file:///home/dunric/Projects/Go/playground/lib/algorithms.go', 'range': {'end': {'character': 12, 'line': 64}, 'start': {'character': 9, 'line': 64}}} {'uri': 'file:///home/dunric/Projects/Go/playground/lib/algorithms.go', 'range': {'end': {'character': 19, 'line': 67}, 'start': {'character': 16, 'line': 67}}} {'uri': 'file:///home/dunric/Projects/Go/playground/lib/algorithms.go', 'range': {'end': {'character': 12, 'line': 68}, 'start': {'character': 9, 'line': 68}}} {'uri': 'file:///home/dunric/Projects/Go/playground/lib/algorithms.go', 'range': {'end': {'character': 4, 'line': 69}, 'start': {'character': 1, 'line': 69}}} {'uri': 'file:///home/dunric/Projects/Go/playground/lib/algorithms.go', 'range': {'end': {'character': 21, 'line': 69}, 'start': {'character': 18, 'line': 69}}} {'uri': 'file:///home/dunric/Projects/Go/playground/lib/algorithms.go', 'range': {'end': {'character': 23, 'line': 71}, 'start': {'character': 20, 'line': 71}}}
:version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Nov 22 2023 21:16:40) Použité záplaty: 1-2121 přeložil Arch Linux
go version
go version go1.21.4 linux/amd64
gopls version
golang.org/x/tools/gopls (devel) golang.org/x/tools/gopls@(devel)
g:go_auto_type_info = 1 g:go_get_update = 0 g:go_doc_balloon = 0 g:go_doc_url = 'http://localhost:6060' g:go_updatetime = 800 g:go_diagnostics_level = 1 g:go_term_enabled = 1 g:go_fold_enable = ['block', 'varconst', 'import'] g:go_metalinter_command = 'staticcheck' g:go_doc_keywordprg_enabled = 1 g:go_doc_popup_window = 0 g:go_auto_sameids = 1 g:go_template_file = '/home/dunric/.vim/templates/skeleton.go' g:go_metalinter_autosave = 1 g:go_gopls_use_placeholders = v:true g:go_jump_to_error = 1 g:go_loaded_gosnippets = 1 g:go_term_mode = 'vertical botright split' g:go_fillstruct_mode = 'gopls' g:go_template_test_file = '/home/dunric/.vim/templates/skeleton_test.go' g:go_loaded_install = 1
filetype detection:ON plugin:ON indent:ON
What did you expect to happen?
GoSameIds
will correctly calculate starting & ending positions for a selected identifier(token) and highligh appropriately.What happened instead?
end position of an identifier is lesser off by 1, when identifier immediately precedes End-Of-Line character:
See non-highlighted
t
oflst
identifier on 65th (64th when zero-indexed) row.Bellow is a tracing output from sameIDsHandler function. Notice
end
ing position on 64th row is 12 instead of 13.Vim version (first three lines from
:version
):VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Nov 22 2023 21:16:40) Použité záplaty: 1-2121 přeložil Arch Linux
Go version (
go version
):go version go1.21.4 linux/amd64
gopls version
gopls version
Output:vim-go configuration:
vim-go configuration
filetype detection configuration:
filetype detection