@@ -6,11 +6,27 @@ import os = require('os');
66import path = require( 'path' ) ;
77import vscode = require( 'vscode' ) ;
88import { 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+ }
1025
1126export class RemoteFilesFeature implements IFeature {
1227
1328 private tempSessionPathPrefix : string ;
29+ private languageClient : LanguageClient ;
1430
1531 constructor ( ) {
1632 // Get the common PowerShell Editor Services temporary file path
@@ -22,18 +38,19 @@ export class RemoteFilesFeature implements IFeature {
2238 // At startup, close any lingering temporary remote files
2339 this . closeRemoteFiles ( ) ;
2440
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.
2841 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+ } ) ;
3248 }
3349 } )
3450 }
3551
3652 public setLanguageClient ( languageclient : LanguageClient ) {
53+ this . languageClient = languageclient ;
3754 }
3855
3956 public dispose ( ) {
0 commit comments