nikeee / nikeee/dot-language-server

No back Code Action ,when cursor in diagostic range.

Open
#7 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
52
Forks
4
Avg merge
35m
Merged PRs (30d)
5

Description

When I move cursor to diagostic range, I want get code action, but callback nothing.

If I select diagostic range, lsp will back.

I think if cursor in diagostic range and get back action tip is better.

file: demo1.dot

graph demo {
	"Bowser" ->  {"Chrome" "firefox" "Safari" "..."}
}

cursor in range : no action

 -> {"jsonrpc":"2.0","method":"textDocument/codeAction","params":{"context":{"diagnostics":[{"code":"DOT4000","message":"Invalid edge operation, use \"--\" in undirected graph","range":{"end":{"character":12,"line":1},"start":{"character":10,"line":1}},"severity":1}]},"range":{"end":{"character":11,"line":1},"start":{"character":10,"line":1}},"textDocument":{"uri":"file:///Users/erasin/Development/uml-demo/demo1.dot"}},"id":41}
 <- {"jsonrpc":"2.0","id":41,"result":null}
 <- null
 -> {"jsonrpc":"2.0","method":"textDocument/codeAction","params":{"context":{"diagnostics":[{"code":"DOT4000","message":"Invalid edge operation, use \"--\" in undirected graph","range":{"end":{"character":12,"line":1},"start":{"character":10,"line":1}},"severity":1}]},"range":{"end":{"character":12,"line":1},"start":{"character":11,"line":1}},"textDocument":{"uri":"file:///Users/erasin/Development/uml-demo/demo1.dot"}},"id":42}
 <- {"jsonrpc":"2.0","id":42,"result":null}
 <- null

cursor select diagnostics: have action back

 -> {"jsonrpc":"2.0","method":"textDocument/codeAction","params":{"context":{"diagnostics":[{"code":"DOT4000","message":"Invalid edge operation, use \"--\" in undirected graph","range":{"end":{"character":12,"line":1},"start":{"character":10,"line":1}},"severity":1}]},"range":{"end":{"character":12,"line":1},"start":{"character":10,"line":1}},"textDocument":{"uri":"file:///Users/erasin/Development/uml-demo/demo1.dot"}},"id":43}
 <- {"jsonrpc":"2.0","id":43,"result":[{"title":"Change \"->\" to \"--\".","command":"DOT.changeEdgeOp","arguments":[23,25,"--","file:///Users/erasin/Development/uml-demo/demo1.dot"]},{"title":"Fix all edges to match graph","command":"DOT.convertGraphType","arguments":[[{"start":23,"end":25}],"--",{"start":0,"end":5},"graph","file:///Users/erasin/Development/uml-demo/demo1.dot"]},{"title":"Convert graph to digraph","command":"DOT.convertGraphType","arguments":[[],"->",{"start":0,"end":5},"digraph","file:///Users/erasin/Development/uml-demo/demo1.dot"]}]}
 <- [{"arguments":[23,25,"--","file:///Users/erasin/Development/uml-demo/demo1.dot"],"command":"DOT.changeEdgeOp","title":"Change \"->\" to \"--\"."},{"arguments":[[{"end":25,"start":23}],"--",{"end":5,"start":0},"graph","file:///Users/erasin/Development/uml-demo/demo1.dot"],"command":"DOT.convertGraphType","title":"Fix all edges to match graph"},{"arguments":[[],"->",{"end":5,"start":0},"digraph","file:///Users/erasin/Development/uml-demo/demo1.dot"],"command":"DOT.convertGraphType","title":"Convert graph to digraph"}]

node
v18.6.0

lsp version
1.1.17

os
Macos

termial
Alacritty

editor
helix editor

lang support add ~/.config/helix/language.toml

[[language]]
name = "dot"
scope = "source.dot"
injection-regex = "dot"
file-types = ["dot"]
roots = []
comment-token = "//"
indent = { tab-width = 4, unit = "    " }
language-server = { command = "dot-language-server", args = ["--stdio"] }

[[grammar]]
name = "dot"
source = { git = "https://github.com/rydesun/tree-sitter-dot", rev = "917230743aa10f45a408fea2ddb54bbbf5fbe7b7" }

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the textDocument/codeAction request handling and reproduce the behavior using demo1.dot and the logged ranges. Compare the response when the cursor is inside versus exactly covering the diagnostic range; done means the expected code actions are returned for a cursor inside that range.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.