@@ -6,7 +6,7 @@ import * as fse from 'fs-extra';
66import * as os from 'os' ;
77import * as path from 'path' ;
88import * as semver from 'semver' ;
9- import { CodeActionContext , commands , CompletionItem , ConfigurationTarget , Diagnostic , env , EventEmitter , ExtensionContext , extensions , IndentAction , InputBoxOptions , languages , Location , MarkdownString , QuickPickItemKind , Range , RelativePattern , SnippetString , SnippetTextEdit , TextDocument , TextEditorRevealType , UIKind , Uri , ViewColumn , window , workspace , WorkspaceConfiguration , WorkspaceEdit } from 'vscode' ;
9+ import { CodeActionContext , commands , CompletionItem , ConfigurationTarget , Diagnostic , env , EventEmitter , ExtensionContext , extensions , IndentAction , InputBoxOptions , languages , Location , MarkdownString , QuickPickItemKind , Range , RelativePattern , SnippetString , SnippetTextEdit , TextDocument , TextEditorRevealType , UIKind , Uri , version , ViewColumn , window , workspace , WorkspaceConfiguration , WorkspaceEdit } from 'vscode' ;
1010import { CancellationToken , CodeActionParams , CodeActionRequest , CodeActionResolveRequest , Command , CompletionRequest , DidChangeConfigurationNotification , ExecuteCommandParams , ExecuteCommandRequest , LanguageClientOptions , RevealOutputChannelOn } from 'vscode-languageclient' ;
1111import { LanguageClient } from 'vscode-languageclient/node' ;
1212import { apiManager } from './apiManager' ;
@@ -318,7 +318,11 @@ export async function activate(context: ExtensionContext): Promise<ExtensionAPI>
318318 for ( const edit of docChange . edits ) {
319319 if ( "snippet" in edit ) {
320320 documentUris . push ( Uri . parse ( docChange . textDocument . uri ) . toString ( ) ) ;
321- snippetEdits . push ( new SnippetTextEdit ( client . protocol2CodeConverter . asRange ( ( edit as any ) . range ) , new SnippetString ( ( edit as any ) . snippet . value ) ) ) ;
321+ const snippet = new SnippetTextEdit ( client . protocol2CodeConverter . asRange ( ( edit as any ) . range ) , new SnippetString ( ( edit as any ) . snippet . value ) ) ;
322+ if ( semver . gte ( version , '1.98.0' ) ) {
323+ snippet [ "keepWhitespace" ] = true ;
324+ }
325+ snippetEdits . push ( snippet ) ;
322326 }
323327 }
324328 }
0 commit comments