@@ -631,13 +631,18 @@ func (handler *InoHandler) transformClangdResult(method string, uri lsp.Document
631
631
632
632
func (handler * InoHandler ) cpp2inoCompletionList (list * lsp.CompletionList , uri lsp.DocumentURI ) {
633
633
if data , ok := handler .data [uri ]; ok {
634
+ newItems := make ([]lsp.CompletionItem , 0 , len (list .Items ))
634
635
for _ , item := range list .Items {
635
- if item .TextEdit != nil {
636
- r := & item .TextEdit .Range
637
- r .Start .Line = data .sourceLineMap [r .Start .Line ]
638
- r .End .Line = data .sourceLineMap [r .End .Line ]
636
+ if (! strings .HasPrefix (item .InsertText , "_" )) {
637
+ if item .TextEdit != nil {
638
+ r := & item .TextEdit .Range
639
+ r .Start .Line = data .sourceLineMap [r .Start .Line ]
640
+ r .End .Line = data .sourceLineMap [r .End .Line ]
641
+ }
642
+ newItems = append (newItems , item )
639
643
}
640
644
}
645
+ list .Items = newItems ;
641
646
}
642
647
}
643
648
@@ -731,7 +736,7 @@ func (handler *InoHandler) cpp2inoDocumentSymbols(origSymbols []DocumentSymbol,
731
736
duplicate := false
732
737
other , duplicate := symbolIdx [symbol .Name ]
733
738
if duplicate {
734
- // we prefer symbols later in the file due to the function header generation. E.g. if one has a function `void foo() {}` somehwre in the code
739
+ // We prefer symbols later in the file due to the function header generation. E.g. if one has a function `void foo() {}` somehwre in the code
735
740
// the code generation will add a `void foo();` header at the beginning of the cpp file. We care about the function body later in the file, not
736
741
// the header early on.
737
742
if other .Range .Start .Line < symbol .Range .Start .Line {
@@ -755,7 +760,7 @@ func (handler *InoHandler) cpp2inoDocumentSymbols(origSymbols []DocumentSymbol,
755
760
}
756
761
757
762
func (handler * InoHandler ) cpp2inoSymbolInformation (syms []* lsp.SymbolInformation ) []lsp.SymbolInformation {
758
- // much like in cpp2inoDocumentSymbols we de-duplicate symbols based on file in-file location.
763
+ // Much like in cpp2inoDocumentSymbols we de-duplicate symbols based on file in-file location.
759
764
idx := make (map [string ]* lsp.SymbolInformation )
760
765
for _ , sym := range syms {
761
766
handler .cpp2inoLocation (& sym .Location )
0 commit comments