@@ -631,13 +631,18 @@ func (handler *InoHandler) transformClangdResult(method string, uri lsp.Document
631631
632632func (handler * InoHandler ) cpp2inoCompletionList (list * lsp.CompletionList , uri lsp.DocumentURI ) {
633633 if data , ok := handler .data [uri ]; ok {
634+ newItems := make ([]lsp.CompletionItem , 0 , len (list .Items ))
634635 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 )
639643 }
640644 }
645+ list .Items = newItems ;
641646 }
642647}
643648
@@ -731,7 +736,7 @@ func (handler *InoHandler) cpp2inoDocumentSymbols(origSymbols []DocumentSymbol,
731736 duplicate := false
732737 other , duplicate := symbolIdx [symbol .Name ]
733738 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
735740 // 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
736741 // the header early on.
737742 if other .Range .Start .Line < symbol .Range .Start .Line {
@@ -755,7 +760,7 @@ func (handler *InoHandler) cpp2inoDocumentSymbols(origSymbols []DocumentSymbol,
755760}
756761
757762func (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.
759764 idx := make (map [string ]* lsp.SymbolInformation )
760765 for _ , sym := range syms {
761766 handler .cpp2inoLocation (& sym .Location )
0 commit comments