@@ -6,11 +6,27 @@ import os = require('os');
6
6
import path = require( 'path' ) ;
7
7
import vscode = require( 'vscode' ) ;
8
8
import { IFeature } from '../feature' ;
9
- import { LanguageClient , RequestType , NotificationType } from 'vscode-languageclient' ;
9
+ import { LanguageClient , RequestType , NotificationType , TextDocumentIdentifier } from 'vscode-languageclient' ;
10
+
11
+ // NOTE: The following two DidSaveTextDocument* types will
12
+ // be removed when #593 gets fixed.
13
+
14
+ export interface DidSaveTextDocumentParams {
15
+ /**
16
+ * The document that was closed.
17
+ */
18
+ textDocument : TextDocumentIdentifier ;
19
+ }
20
+
21
+ export namespace DidSaveTextDocumentNotification {
22
+ export const type : NotificationType < DidSaveTextDocumentParams > =
23
+ { get method ( ) { return 'textDocument/didSave' ; } }
24
+ }
10
25
11
26
export class RemoteFilesFeature implements IFeature {
12
27
13
28
private tempSessionPathPrefix : string ;
29
+ private languageClient : LanguageClient ;
14
30
15
31
constructor ( ) {
16
32
// Get the common PowerShell Editor Services temporary file path
@@ -22,18 +38,19 @@ export class RemoteFilesFeature implements IFeature {
22
38
// At startup, close any lingering temporary remote files
23
39
this . closeRemoteFiles ( ) ;
24
40
25
- // TEMPORARY: Register for the onDidSave event so that we can alert
26
- // the user when they attempt to save a remote file. We don't
27
- // currently propagate saved content back to the remote session.
28
41
vscode . workspace . onDidSaveTextDocument ( doc => {
29
- if ( this . isDocumentRemote ( doc ) ) {
30
- vscode . window . showWarningMessage (
31
- "Changes to remote files are not yet saved back in the remote session, coming in 0.10.0." ) ;
42
+ if ( this . languageClient && this . isDocumentRemote ( doc ) ) {
43
+ this . languageClient . sendNotification (
44
+ DidSaveTextDocumentNotification . type ,
45
+ {
46
+ textDocument : TextDocumentIdentifier . create ( doc . uri . toString ( ) )
47
+ } ) ;
32
48
}
33
49
} )
34
50
}
35
51
36
52
public setLanguageClient ( languageclient : LanguageClient ) {
53
+ this . languageClient = languageclient ;
37
54
}
38
55
39
56
public dispose ( ) {
0 commit comments