@@ -60,20 +60,26 @@ export default class OmnisharpCompletionProvider extends AbstractProvider implem
60
60
}
61
61
62
62
private _convertToVscodeCompletionItem ( omnisharpCompletion : protocol . OmnisharpCompletionItem ) : CompletionItem {
63
- let docs : MarkdownString | undefined = omnisharpCompletion . Documentation ? new MarkdownString ( omnisharpCompletion . Documentation , false ) : undefined ;
63
+ const docs : MarkdownString | undefined = omnisharpCompletion . Documentation ? new MarkdownString ( omnisharpCompletion . Documentation , false ) : undefined ;
64
64
65
- const mapTextEdit = function ( edit : protocol . LinePositionSpanTextChange ) : TextEdit {
65
+ const mapRange = function ( edit : protocol . LinePositionSpanTextChange ) : Range {
66
66
const newStart = new Position ( edit . StartLine - 1 , edit . StartColumn - 1 ) ;
67
67
const newEnd = new Position ( edit . EndLine - 1 , edit . EndColumn - 1 ) ;
68
- const newRange = new Range ( newStart , newEnd ) ;
69
- return new TextEdit ( newRange , edit . NewText ) ;
68
+ return new Range ( newStart , newEnd ) ;
69
+ } ;
70
+
71
+ const mapTextEdit = function ( edit : protocol . LinePositionSpanTextChange ) : TextEdit {
72
+ return new TextEdit ( mapRange ( edit ) , edit . NewText ) ;
70
73
} ;
71
74
72
75
const additionalTextEdits = omnisharpCompletion . AdditionalTextEdits ?. map ( mapTextEdit ) ;
73
76
77
+ const newText = omnisharpCompletion . TextEdit ?. NewText ?? omnisharpCompletion . InsertText ;
74
78
const insertText = omnisharpCompletion . InsertTextFormat === InsertTextFormat . Snippet
75
- ? new SnippetString ( omnisharpCompletion . InsertText )
76
- : omnisharpCompletion . InsertText ;
79
+ ? new SnippetString ( newText )
80
+ : newText ;
81
+
82
+ const insertRange = omnisharpCompletion . TextEdit ? mapRange ( omnisharpCompletion . TextEdit ) : undefined ;
77
83
78
84
return {
79
85
label : omnisharpCompletion . Label ,
@@ -84,6 +90,7 @@ export default class OmnisharpCompletionProvider extends AbstractProvider implem
84
90
preselect : omnisharpCompletion . Preselect ,
85
91
filterText : omnisharpCompletion . FilterText ,
86
92
insertText : insertText ,
93
+ range : insertRange ,
87
94
tags : omnisharpCompletion . Tags ,
88
95
sortText : omnisharpCompletion . SortText ,
89
96
additionalTextEdits : additionalTextEdits ,
0 commit comments