Skip to content

No back Code Action ,when cursor in diagostic range. #7

@erasin

Description

@erasin

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" }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions