Skip to content
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: ensure that the diagnostic parameters are complete #179

Merged
merged 2 commits into from
Feb 19, 2023
Merged

fix: ensure that the diagnostic parameters are complete #179

merged 2 commits into from
Feb 19, 2023

Conversation

0x7a7a
Copy link
Contributor

@0x7a7a 0x7a7a commented Apr 28, 2022

fix #156

debug

  1. The range.start.character field may not exist
  2. The range.end field may not exist

log

{                                                                                                                                                                                                                                               
  bufnr = 6,                                                                                                                                                                                                                                    
  col = 12,                                                                                                                                                                                                                                     
  end_col = 27,                                                                                                                                                                                                                                 
  end_lnum = 74,                                                                                                                                                                                                                                
  lnum = 74,                                                                                                                                                                                                                                    
  message = "could use strings.ReplaceAll instead",                                                                                                                                                                                             
  namespace = 25,                                                                                                                                                                                                                               
  range = {                                                                                                                                                                                                                                     
    start = {                                                                                                                                                                                                                                   
      line = 74                                                                                                                                                                                                                                 
    }                                                                                                                                                                                                                                           
  },                                                                                                                                                                                                                                            
  severity = 4,                                                                                                                                                                                                                                 
  source = "QF1004",                                                                                                                                                                                                                            
  user_data = {                                                                                                                                                                                                                                 
    lsp = {}                                                                                                                                                                                                                                    
  }                                                                                                                                                                                                                                             
} 

@0x7a7a
Copy link
Contributor Author

0x7a7a commented Apr 28, 2022

@folke
Can we just change it to:

local start = {
  line = item.col,
  character = item.lnum,
}
local finish = {
  line = item.end_col,
  character = item.end_lnum,
}

Looks the same as the value in range

@ryo33
Copy link

ryo33 commented Feb 19, 2023

This is what I was going to fix. The range field seems to be not defined in Neovim docs and some LSP, e.g. lua-ls, emit diagnostic items with range field but without end field in it.

@folke folke merged commit 210969f into folke:main Feb 19, 2023
@folke
Copy link
Owner

folke commented Feb 19, 2023

Sorry for the late reply. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TroubleToggle error when toggling in twice
3 participants