-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(main): check if line is nil when colorizing lsp range #687
fix(main): check if line is nil when colorizing lsp range #687
Conversation
lua/fzfx/cfg/_lsp_locations.lua
Outdated
@@ -47,6 +47,9 @@ end | |||
--- @param renderer fun(text:string):string | |||
--- @return string? | |||
M._colorize_lsp_range = function(line, range, renderer) | |||
if not line then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @stong1994 ,
Can you use str.empty(line)
to detect whether a line
is nil or empty string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have identified the issue. It appears there is a problem when executing the vim.lsp.buf_request_sync
function(the 'method' param is "callHierarchy/outgoingCalls"), as the response I received is incorrect.
I have generated some logs to help diagnose the problem, and here is the output:
The crux of the issue is that the sms_error.go
file contains only 24 lines of code. However, the fromRange in the response is pointing to lines 38 and 68, which is not possible given the file's length.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @stong1994 , thanks to your work!
can you give me a golang repository that can reproduce this issue? so I may also could help fix this issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And, can you take a look at this line:
fzfx.nvim/lua/fzfx/cfg/_lsp_locations.lua
Line 398 in 9b70ddb
log.debug( |
It's the request body that sent to the lsp server, can you help verify if the request is correct?
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @stong1994 ,
Once you had tested these changes, please select the related items in the "Regresion test" check list, to make sure they're working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @linrongbin16
The 'Ctrl+J' and 'Ctrl+K' shortcuts are not working. Could I be missing some configuration settings?
Press CTRL-J/CTRL-K to move down/up and preview contents.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can simply skip CTRL-J/CTRL-K keys.
Just see if the outgoing/incoming calls results are expected, without exceptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, It works well in my macOS.
hi @stong1994 , |
Should I create a new PR? |
…_colorize_lsp_range
Ok, I has merged the latest main branch |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #687 +/- ##
==========================================
- Coverage 79.11% 79.10% -0.01%
==========================================
Files 53 53
Lines 6296 6298 +2
==========================================
+ Hits 4981 4982 +1
- Misses 1315 1316 +1 ☔ View full report in Codecov by Sentry. |
change code style in _lsp_locations.lua
It lacks index check with filelines when calling _colorize_lsp_range in _render_lsp_hierarchy_line. After that, we don't need to check if line is empty.
fix: #685
Regresion test
Platforms
Tasks
CTRL-J
/CTRL-K
to move down/up and preview contents.CTRL-U
/CTRL-R
to switch between restricted/unrestricted mode, and the lines count is consistent when press multiple times.V
/W
/P
/R
variants (visual selection, cursor word, yank text, resume last).ESC
to quit,ENTER
to open file, and open thetest/hello world.txt
,test/goodbye world/goodbye.lua
files.fd
andfind
works.CTRL-J
/CTRL-K
to move down/up and preview contents.CTRL-U
/CTRL-R
to switch between restricted/unrestricted mode, and the lines count is consistent when press multiple times.-w
to match word only, use-g *.lua
to search only lua files.V
/W
/P
/R
variants (visual selection, cursor word, yank text, resume last).ESC
to quit,ENTER
to open file, and open thetest/hello world.txt
,test/goodbye world/goodbye.lua
files.rg
andgrep
works.CTRL-J
/CTRL-K
to move down/up and preview contents.-w
to match word only, use-g *.lua
to search only lua files.V
/W
/P
/R
variants (visual selection, cursor word, yank text, resume last).ESC
to quit,ENTER
to open file.rg
andgrep
works.CTRL-J
/CTRL-K
to move down/up and preview contents.CTRL-D
to delete buffers, and delete thetest/hello world.txt
,test/goodbye world/goodbye.lua
buffers.V
/W
/P
/R
variants (visual selection, cursor word, yank text, resume last).ESC
to quit,ENTER
to open file.CTRL-J
/CTRL-K
to move down/up and preview contents.CTRL-U
/CTRL-W
to switch between workspace/current folder mode.V
/W
/P
/R
variants (visual selection, cursor word, yank text, resume last).ESC
to quit,ENTER
to open file.CTRL-J
/CTRL-K
to move down/up and preview contents.V
/W
/P
/R
variants (visual selection, cursor word, yank text, resume last).ESC
to quit,ENTER
to open file.CTRL-J
/CTRL-K
to move down/up and preview contents.CTRL-U
/CTRL-W
to switch between workspace/current folder mode.V
/W
/P
/R
variants (visual selection, cursor word, yank text, resume last).ESC
to quit,ENTER
to open file.delta
works.CTRL-J
/CTRL-K
to move down/up and preview contents.CTRL-R
/CTRL-O
to switch between local/remote branches.V
/W
/P
/R
variants (visual selection, cursor word, yank text, resume last).ESC
to quit,ENTER
to checkout branch.CTRL-J
/CTRL-K
to move down/up and preview contents.CTRL-U
/CTRL-A
to switch between git repo commits/current buffer commits.V
/W
/P
/R
variants (visual selection, cursor word, yank text, resume last).ESC
to quit,ENTER
to copy commit hash.delta
works.CTRL-J
/CTRL-K
to move down/up and preview contents.V
/W
/P
/R
variants (visual selection, cursor word, yank text, resume last).ESC
to quit,ENTER
to copy commit hash.delta
works.CTRL-J
/CTRL-K
to move down/up and preview contents.CTRL-U
/CTRL-W
to switch between workspace/current buffer diagnostics.V
/W
/P
/R
variants (visual selection, cursor word, yank text, resume last).ESC
to quit,ENTER
to open file.CTRL-J
/CTRL-K
to move down/up and preview contents.ESC
to quit,ENTER
to open file.CTRL-J
/CTRL-K
to move down/up and preview contents.ESC
to quit,ENTER
to open file.CTRL-J
/CTRL-K
to move down/up and preview contents.CTRL-U
/CTRL-E
/CTRL-A
to switch between user/ex/all vim commands.V
/W
/P
/R
variants (visual selection, cursor word, yank text, resume last).ESC
to quit,ENTER
to feed vim command.CTRL-J
/CTRL-K
to move down/up and preview contents.CTRL-O
/CTRL-I
/CTRL-A
/CTRL-V
to switch between normal/insert/visual/all vim key mappings.V
/W
/P
/R
variants (visual selection, cursor word, yank text, resume last).ESC
to quit,ENTER
to feed vim keys.CTRL-J
/CTRL-K
to move down/up and preview contents.V
/W
/P
/R
variants (visual selection, cursor word, yank text, resume last).ESC
to quit,ENTER
to open file.CTRL-J
/CTRL-K
to move down/up and preview contents.CTRL-U
/CTRL-R
to switch between filter/include hidden files mode.ALT-L
/ALT-H
to cd into folder and cd upper folder.V
/W
/P
/R
variants (visual selection, cursor word, yank text, resume last).ESC
to quit,ENTER
to open file, and open thetest/hello world.txt
,test/goodbye world/goodbye.lua
files.eza
/lsd
/ls
works.