@@ -691,6 +691,15 @@ func (handler *InoHandler) transformClangdResult(method string, uri lsp.Document
691691 defer handler .synchronizer .DataMux .RUnlock ()
692692
693693 switch r := result .(type ) {
694+ case * lsp.Hover :
695+ // method "textDocument/hover"
696+ if len (r .Contents .Value ) == 0 {
697+ return nil
698+ }
699+ if uri .AsPath ().EquivalentTo (handler .buildSketchCpp ) {
700+ _ , * r .Range = handler .sketchMapper .CppToInoRange (* r .Range )
701+ }
702+
694703 case * lsp.CompletionList : // "textDocument/completion":
695704 handler .cpp2inoCompletionList (r , uri )
696705 case * []* lsp.CommandOrCodeAction : // "textDocument/codeAction":
@@ -704,11 +713,6 @@ func (handler *InoHandler) transformClangdResult(method string, uri lsp.Document
704713 handler .cpp2inoCodeAction (codeAction , uri )
705714 }
706715 }
707- case * lsp.Hover : // "textDocument/hover":
708- if len (r .Contents .Value ) == 0 {
709- return nil
710- }
711- handler .cpp2inoHover (r , uri )
712716 // case "textDocument/definition":
713717 // fallthrough
714718 // case "textDocument/typeDefinition":
@@ -816,15 +820,6 @@ func (handler *InoHandler) cpp2inoWorkspaceEdit(origEdit *lsp.WorkspaceEdit) *ls
816820 return & newEdit
817821}
818822
819- func (handler * InoHandler ) cpp2inoHover (hover * lsp.Hover , uri lsp.DocumentURI ) {
820- if data , ok := handler .data [uri ]; ok {
821- r := hover .Range
822- if r != nil {
823- _ , * r = data .sourceMap .CppToInoRange (* r )
824- }
825- }
826- }
827-
828823func (handler * InoHandler ) cpp2inoLocation (location * lsp.Location ) {
829824 if data , ok := handler .data [location .URI ]; ok {
830825 location .URI = data .sourceURI
0 commit comments