@@ -6,7 +6,7 @@ import * as fse from 'fs-extra';
6
6
import * as os from 'os' ;
7
7
import * as path from 'path' ;
8
8
import * 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' ;
10
10
import { CancellationToken , CodeActionParams , CodeActionRequest , CodeActionResolveRequest , Command , CompletionRequest , DidChangeConfigurationNotification , ExecuteCommandParams , ExecuteCommandRequest , LanguageClientOptions , RevealOutputChannelOn } from 'vscode-languageclient' ;
11
11
import { LanguageClient } from 'vscode-languageclient/node' ;
12
12
import { apiManager } from './apiManager' ;
@@ -318,7 +318,11 @@ export async function activate(context: ExtensionContext): Promise<ExtensionAPI>
318
318
for ( const edit of docChange . edits ) {
319
319
if ( "snippet" in edit ) {
320
320
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 ) ;
322
326
}
323
327
}
324
328
}
0 commit comments