@@ -252,6 +252,7 @@ func (handler *InoHandler) HandleMessageFromIDE(ctx context.Context, conn *jsonr
252
252
log .Printf ("--> %s(%s:%s)" , req .Method , p .TextDocument .URI , p .Position )
253
253
inoURI = p .TextDocument .URI
254
254
if res , e := handler .ino2cppTextDocumentPositionParams (p ); e == nil {
255
+ cppURI = p .TextDocument .URI
255
256
params = res
256
257
log .Printf (" --> %s(%s:%s)" , req .Method , p .TextDocument .URI , p .Position )
257
258
} else {
@@ -960,10 +961,19 @@ func (handler *InoHandler) transformClangdResult(method string, inoURI, cppURI l
960
961
}
961
962
return & inoSymbols
962
963
963
- case * []lsp.DocumentHighlight : // "textDocument/documentHighlight":
964
- for index := range * r {
965
- handler .cpp2inoDocumentHighlight (& (* r )[index ], inoURI )
964
+ case * []lsp.DocumentHighlight :
965
+ // Method: "textDocument/documentHighlight"
966
+ res := []lsp.DocumentHighlight {}
967
+ for _ , cppHL := range * r {
968
+ inoHL , err := handler .cpp2inoDocumentHighlight (& cppHL , cppURI )
969
+ if err != nil {
970
+ log .Printf ("ERROR converting location %s:%s: %s" , cppURI , cppHL .Range , err )
971
+ return nil
972
+ }
973
+ res = append (res , * inoHL )
966
974
}
975
+ return & res
976
+
967
977
case * lsp.WorkspaceEdit : // "textDocument/rename":
968
978
return handler .cpp2inoWorkspaceEdit (r )
969
979
}
@@ -1058,19 +1068,23 @@ func (handler *InoHandler) cpp2inoWorkspaceEdit(origWorkspaceEdit *lsp.Workspace
1058
1068
return resWorkspaceEdit
1059
1069
}
1060
1070
1061
- func (handler * InoHandler ) cpp2inoLocation (inoLocation lsp.Location ) (lsp.Location , error ) {
1062
- cppURI , cppRange , err := handler .cpp2inoDocumentURI (inoLocation .URI , inoLocation .Range )
1071
+ func (handler * InoHandler ) cpp2inoLocation (cppLocation lsp.Location ) (lsp.Location , error ) {
1072
+ inoURI , inoRange , err := handler .cpp2inoDocumentURI (cppLocation .URI , cppLocation .Range )
1063
1073
return lsp.Location {
1064
- URI : cppURI ,
1065
- Range : cppRange ,
1074
+ URI : inoURI ,
1075
+ Range : inoRange ,
1066
1076
}, err
1067
1077
}
1068
1078
1069
- func (handler * InoHandler ) cpp2inoDocumentHighlight (highlight * lsp.DocumentHighlight , uri lsp.DocumentURI ) {
1070
- panic ("not implemented" )
1071
- // if data, ok := handler.data[uri]; ok {
1072
- // _, highlight.Range = data.sourceMap.CppToInoRange(highlight.Range)
1073
- // }
1079
+ func (handler * InoHandler ) cpp2inoDocumentHighlight (cppHighlight * lsp.DocumentHighlight , cppURI lsp.DocumentURI ) (* lsp.DocumentHighlight , error ) {
1080
+ _ , inoRange , err := handler .cpp2inoDocumentURI (cppURI , cppHighlight .Range )
1081
+ if err != nil {
1082
+ return nil , err
1083
+ }
1084
+ return & lsp.DocumentHighlight {
1085
+ Kind : cppHighlight .Kind ,
1086
+ Range : inoRange ,
1087
+ }, nil
1074
1088
}
1075
1089
1076
1090
func (handler * InoHandler ) cpp2inoTextEdits (cppURI lsp.DocumentURI , cppEdits []lsp.TextEdit ) (map [lsp.DocumentURI ][]lsp.TextEdit , error ) {
0 commit comments