@codingame/monaco-vscode-remote-agent-service-override 25.1.2 → 26.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/vscode/src/vs/platform/download/common/downloadIpc.js +4 -3
- package/vscode/src/vs/platform/files/common/diskFileSystemProviderClient.d.ts +1 -1
- package/vscode/src/vs/platform/files/common/diskFileSystemProviderClient.js +44 -49
- package/vscode/src/vs/platform/log/common/logIpc.js +22 -7
- package/vscode/src/vs/platform/remote/browser/browserSocketFactory.js +56 -32
- package/vscode/src/vs/platform/remote/browser/remoteAuthorityResolverService.js +31 -12
- package/vscode/src/vs/platform/remote/common/remoteSocketFactoryService.js +1 -1
- package/vscode/src/vs/workbench/contrib/remote/browser/explorerViewItems.js +23 -21
- package/vscode/src/vs/workbench/contrib/remote/browser/remote.contribution.js +15 -3
- package/vscode/src/vs/workbench/contrib/remote/browser/remote.js +336 -219
- package/vscode/src/vs/workbench/contrib/remote/browser/remoteConnectionHealth.js +67 -49
- package/vscode/src/vs/workbench/contrib/remote/browser/remoteIndicator.js +302 -220
- package/vscode/src/vs/workbench/contrib/remote/browser/remoteStartEntry.contribution.js +1 -2
- package/vscode/src/vs/workbench/contrib/remote/browser/remoteStartEntry.js +28 -23
- package/vscode/src/vs/workbench/contrib/remote/browser/showCandidate.js +6 -7
- package/vscode/src/vs/workbench/contrib/remote/browser/tunnelFactory.js +39 -43
- package/vscode/src/vs/workbench/contrib/remote/common/remote.contribution.js +187 -189
- package/vscode/src/vs/workbench/services/remote/browser/browserRemoteResourceHandler.js +9 -12
- package/vscode/src/vs/workbench/services/remote/browser/remoteAgentService.js +36 -29
- package/vscode/src/vs/workbench/services/remote/common/abstractRemoteAgentService.js +69 -37
- package/vscode/src/vs/workbench/services/remote/common/remoteAgentEnvironmentChannel.d.ts +1 -0
- package/vscode/src/vs/workbench/services/remote/common/remoteAgentEnvironmentChannel.js +1 -0
- package/vscode/src/vs/workbench/services/remote/common/remoteExtensionsScanner.js +18 -17
- package/vscode/src/vs/workbench/services/remote/common/remoteFileSystemProviderClient.js +13 -8
- package/vscode/src/vs/workbench/services/tunnel/browser/tunnelService.js +20 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-remote-agent-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "26.0.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - remote-agent service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-api": "
|
|
19
|
-
"@codingame/monaco-vscode-environment-service-override": "
|
|
18
|
+
"@codingame/monaco-vscode-api": "26.0.1",
|
|
19
|
+
"@codingame/monaco-vscode-environment-service-override": "26.0.1"
|
|
20
20
|
},
|
|
21
21
|
"main": "index.js",
|
|
22
22
|
"module": "index.js",
|
|
@@ -6,13 +6,14 @@ class DownloadServiceChannel {
|
|
|
6
6
|
this.service = service;
|
|
7
7
|
}
|
|
8
8
|
listen(_, event, arg) {
|
|
9
|
-
throw ( new Error(
|
|
9
|
+
throw ( new Error("Invalid listen"));
|
|
10
10
|
}
|
|
11
11
|
call(context, command, args) {
|
|
12
12
|
switch (command) {
|
|
13
|
-
|
|
13
|
+
case "download":
|
|
14
|
+
return this.service.download(URI.revive(args[0]), URI.revive(args[1]));
|
|
14
15
|
}
|
|
15
|
-
throw ( new Error(
|
|
16
|
+
throw ( new Error("Invalid call"));
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
|
|
@@ -4,7 +4,7 @@ import { Disposable, IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/
|
|
|
4
4
|
import { ReadableStreamEvents } from "@codingame/monaco-vscode-api/vscode/vs/base/common/stream";
|
|
5
5
|
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
6
6
|
import { IChannel } from "@codingame/monaco-vscode-api/vscode/vs/base/parts/ipc/common/ipc";
|
|
7
|
-
import {
|
|
7
|
+
import { FileSystemProviderCapabilities, FileType, IFileAtomicReadOptions, IFileChange, IFileDeleteOptions, IFileOpenOptions, IFileOverwriteOptions, IFileReadStreamOptions, IFileSystemProviderWithFileAtomicReadCapability, IFileSystemProviderWithFileCloneCapability, IFileSystemProviderWithFileFolderCopyCapability, IFileSystemProviderWithFileReadStreamCapability, IFileSystemProviderWithFileReadWriteCapability, IFileSystemProviderWithOpenReadWriteCloseCapability, IFileWriteOptions, IStat, IWatchOptions } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files";
|
|
8
8
|
export declare const LOCAL_FILE_SYSTEM_CHANNEL_NAME = "localFilesystem";
|
|
9
9
|
/**
|
|
10
10
|
* An implementation of a local disk file system provider
|
|
@@ -24,17 +24,7 @@ class DiskFileSystemProviderClient extends Disposable {
|
|
|
24
24
|
}
|
|
25
25
|
get capabilities() {
|
|
26
26
|
if (!this._capabilities) {
|
|
27
|
-
this._capabilities =
|
|
28
|
-
FileSystemProviderCapabilities.FileReadWrite |
|
|
29
|
-
FileSystemProviderCapabilities.FileOpenReadWriteClose |
|
|
30
|
-
FileSystemProviderCapabilities.FileReadStream |
|
|
31
|
-
FileSystemProviderCapabilities.FileFolderCopy |
|
|
32
|
-
FileSystemProviderCapabilities.FileWriteUnlock |
|
|
33
|
-
FileSystemProviderCapabilities.FileAtomicRead |
|
|
34
|
-
FileSystemProviderCapabilities.FileAtomicWrite |
|
|
35
|
-
FileSystemProviderCapabilities.FileAtomicDelete |
|
|
36
|
-
FileSystemProviderCapabilities.FileClone |
|
|
37
|
-
FileSystemProviderCapabilities.FileRealpath;
|
|
27
|
+
this._capabilities = FileSystemProviderCapabilities.FileReadWrite | FileSystemProviderCapabilities.FileOpenReadWriteClose | FileSystemProviderCapabilities.FileReadStream | FileSystemProviderCapabilities.FileFolderCopy | FileSystemProviderCapabilities.FileWriteUnlock | FileSystemProviderCapabilities.FileAtomicRead | FileSystemProviderCapabilities.FileAtomicWrite | FileSystemProviderCapabilities.FileAtomicDelete | FileSystemProviderCapabilities.FileAppend | FileSystemProviderCapabilities.FileClone | FileSystemProviderCapabilities.FileRealpath;
|
|
38
28
|
if (this.extraCapabilities.pathCaseSensitive) {
|
|
39
29
|
this._capabilities |= FileSystemProviderCapabilities.PathCaseSensitive;
|
|
40
30
|
}
|
|
@@ -45,44 +35,50 @@ class DiskFileSystemProviderClient extends Disposable {
|
|
|
45
35
|
return this._capabilities;
|
|
46
36
|
}
|
|
47
37
|
stat(resource) {
|
|
48
|
-
return this.channel.call(
|
|
38
|
+
return this.channel.call("stat", [resource]);
|
|
49
39
|
}
|
|
50
40
|
realpath(resource) {
|
|
51
|
-
return this.channel.call(
|
|
41
|
+
return this.channel.call("realpath", [resource]);
|
|
52
42
|
}
|
|
53
43
|
readdir(resource) {
|
|
54
|
-
return this.channel.call(
|
|
44
|
+
return this.channel.call("readdir", [resource]);
|
|
55
45
|
}
|
|
56
46
|
async readFile(resource, opts) {
|
|
57
|
-
const {
|
|
47
|
+
const {
|
|
48
|
+
buffer
|
|
49
|
+
} = await this.channel.call("readFile", [resource, opts]);
|
|
58
50
|
return buffer;
|
|
59
51
|
}
|
|
60
52
|
readFileStream(resource, opts, token) {
|
|
61
53
|
const stream = newWriteableStream(data => VSBuffer.concat(( data.map(data => VSBuffer.wrap(data)))).buffer);
|
|
62
54
|
const disposables = ( new DisposableStore());
|
|
63
|
-
disposables.add(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
else {
|
|
68
|
-
if (dataOrErrorOrEnd === 'end') {
|
|
69
|
-
stream.end();
|
|
55
|
+
disposables.add(
|
|
56
|
+
this.channel.listen("readFileStream", [resource, opts])(dataOrErrorOrEnd => {
|
|
57
|
+
if (dataOrErrorOrEnd instanceof VSBuffer) {
|
|
58
|
+
stream.write(dataOrErrorOrEnd.buffer);
|
|
70
59
|
}
|
|
71
60
|
else {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
61
|
+
if (dataOrErrorOrEnd === "end") {
|
|
62
|
+
stream.end();
|
|
63
|
+
} else {
|
|
64
|
+
let error;
|
|
65
|
+
if (dataOrErrorOrEnd instanceof Error) {
|
|
66
|
+
error = dataOrErrorOrEnd;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
const errorCandidate = dataOrErrorOrEnd;
|
|
70
|
+
error = createFileSystemProviderError(
|
|
71
|
+
errorCandidate.message ?? toErrorMessage(errorCandidate),
|
|
72
|
+
errorCandidate.code ?? FileSystemProviderErrorCode.Unknown
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
stream.error(error);
|
|
76
|
+
stream.end();
|
|
79
77
|
}
|
|
80
|
-
|
|
81
|
-
stream.end();
|
|
78
|
+
disposables.dispose();
|
|
82
79
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}));
|
|
80
|
+
})
|
|
81
|
+
);
|
|
86
82
|
disposables.add(token.onCancellationRequested(() => {
|
|
87
83
|
stream.error(canceled());
|
|
88
84
|
stream.end();
|
|
@@ -91,44 +87,43 @@ class DiskFileSystemProviderClient extends Disposable {
|
|
|
91
87
|
return stream;
|
|
92
88
|
}
|
|
93
89
|
writeFile(resource, content, opts) {
|
|
94
|
-
return this.channel.call(
|
|
90
|
+
return this.channel.call("writeFile", [resource, VSBuffer.wrap(content), opts]);
|
|
95
91
|
}
|
|
96
92
|
open(resource, opts) {
|
|
97
|
-
return this.channel.call(
|
|
93
|
+
return this.channel.call("open", [resource, opts]);
|
|
98
94
|
}
|
|
99
95
|
close(fd) {
|
|
100
|
-
return this.channel.call(
|
|
96
|
+
return this.channel.call("close", [fd]);
|
|
101
97
|
}
|
|
102
98
|
async read(fd, pos, data, offset, length) {
|
|
103
|
-
const [bytes, bytesRead] = await this.channel.call(
|
|
99
|
+
const [bytes, bytesRead] = await this.channel.call("read", [fd, pos, length]);
|
|
104
100
|
data.set(bytes.buffer.slice(0, bytesRead), offset);
|
|
105
101
|
return bytesRead;
|
|
106
102
|
}
|
|
107
103
|
write(fd, pos, data, offset, length) {
|
|
108
|
-
return this.channel.call(
|
|
104
|
+
return this.channel.call("write", [fd, pos, VSBuffer.wrap(data), offset, length]);
|
|
109
105
|
}
|
|
110
106
|
mkdir(resource) {
|
|
111
|
-
return this.channel.call(
|
|
107
|
+
return this.channel.call("mkdir", [resource]);
|
|
112
108
|
}
|
|
113
109
|
delete(resource, opts) {
|
|
114
|
-
return this.channel.call(
|
|
110
|
+
return this.channel.call("delete", [resource, opts]);
|
|
115
111
|
}
|
|
116
112
|
rename(resource, target, opts) {
|
|
117
|
-
return this.channel.call(
|
|
113
|
+
return this.channel.call("rename", [resource, target, opts]);
|
|
118
114
|
}
|
|
119
115
|
copy(resource, target, opts) {
|
|
120
|
-
return this.channel.call(
|
|
116
|
+
return this.channel.call("copy", [resource, target, opts]);
|
|
121
117
|
}
|
|
122
118
|
cloneFile(resource, target) {
|
|
123
|
-
return this.channel.call(
|
|
119
|
+
return this.channel.call("cloneFile", [resource, target]);
|
|
124
120
|
}
|
|
125
121
|
registerFileChangeListeners() {
|
|
126
|
-
this._register(this.channel.listen(
|
|
122
|
+
this._register(this.channel.listen("fileChange", [this.sessionId])(eventsOrError => {
|
|
127
123
|
if (Array.isArray(eventsOrError)) {
|
|
128
124
|
const events = eventsOrError;
|
|
129
125
|
this._onDidChange.fire(reviveFileChanges(events));
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
126
|
+
} else {
|
|
132
127
|
const error = eventsOrError;
|
|
133
128
|
this._onDidWatchError.fire(error);
|
|
134
129
|
}
|
|
@@ -136,8 +131,8 @@ class DiskFileSystemProviderClient extends Disposable {
|
|
|
136
131
|
}
|
|
137
132
|
watch(resource, opts) {
|
|
138
133
|
const req = generateUuid();
|
|
139
|
-
this.channel.call(
|
|
140
|
-
return toDisposable(() => this.channel.call(
|
|
134
|
+
this.channel.call("watch", [this.sessionId, req, resource, opts]);
|
|
135
|
+
return toDisposable(() => this.channel.call("unwatch", [this.sessionId, req]));
|
|
141
136
|
}
|
|
142
137
|
}
|
|
143
138
|
|
|
@@ -7,17 +7,32 @@ import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/l
|
|
|
7
7
|
class RemoteLoggerChannelClient extends Disposable {
|
|
8
8
|
constructor(loggerService, channel) {
|
|
9
9
|
super();
|
|
10
|
-
channel.call(
|
|
11
|
-
this._register(
|
|
12
|
-
|
|
10
|
+
channel.call("setLogLevel", [loggerService.getLogLevel()]);
|
|
11
|
+
this._register(
|
|
12
|
+
loggerService.onDidChangeLogLevel(arg => channel.call("setLogLevel", [arg]))
|
|
13
|
+
);
|
|
14
|
+
channel.call("getRegisteredLoggers").then(loggers => {
|
|
13
15
|
for (const loggerResource of loggers) {
|
|
14
|
-
loggerService.registerLogger({
|
|
16
|
+
loggerService.registerLogger({
|
|
17
|
+
...loggerResource,
|
|
18
|
+
resource: URI.revive(loggerResource.resource)
|
|
19
|
+
});
|
|
15
20
|
}
|
|
16
21
|
});
|
|
17
|
-
this._register(channel.listen(
|
|
18
|
-
|
|
22
|
+
this._register(channel.listen("onDidChangeVisibility")(
|
|
23
|
+
([resource, visibility]) => loggerService.setVisibility(URI.revive(resource), visibility)
|
|
24
|
+
));
|
|
25
|
+
this._register(channel.listen("onDidChangeLoggers")((
|
|
26
|
+
{
|
|
27
|
+
added,
|
|
28
|
+
removed
|
|
29
|
+
}
|
|
30
|
+
) => {
|
|
19
31
|
for (const loggerResource of added) {
|
|
20
|
-
loggerService.registerLogger({
|
|
32
|
+
loggerService.registerLogger({
|
|
33
|
+
...loggerResource,
|
|
34
|
+
resource: URI.revive(loggerResource.resource)
|
|
35
|
+
});
|
|
21
36
|
}
|
|
22
37
|
for (const loggerResource of removed) {
|
|
23
38
|
loggerService.deregisterLogger(loggerResource.resource);
|
|
@@ -24,12 +24,15 @@ class BrowserWebSocket extends Disposable {
|
|
|
24
24
|
this.onError = this._onError.event;
|
|
25
25
|
this._debugLabel = debugLabel;
|
|
26
26
|
this._socket = ( new WebSocket(url));
|
|
27
|
-
this.traceSocketEvent(SocketDiagnosticsEventType.Created, {
|
|
27
|
+
this.traceSocketEvent(SocketDiagnosticsEventType.Created, {
|
|
28
|
+
type: "BrowserWebSocket",
|
|
29
|
+
url
|
|
30
|
+
});
|
|
28
31
|
this._fileReader = ( new FileReader());
|
|
29
32
|
this._queue = [];
|
|
30
33
|
this._isReading = false;
|
|
31
34
|
this._isClosed = false;
|
|
32
|
-
this._fileReader.onload =
|
|
35
|
+
this._fileReader.onload = event => {
|
|
33
36
|
this._isReading = false;
|
|
34
37
|
const buff = event.target.result;
|
|
35
38
|
this.traceSocketEvent(SocketDiagnosticsEventType.Read, buff);
|
|
@@ -38,7 +41,7 @@ class BrowserWebSocket extends Disposable {
|
|
|
38
41
|
enqueue(this._queue.shift());
|
|
39
42
|
}
|
|
40
43
|
};
|
|
41
|
-
const enqueue =
|
|
44
|
+
const enqueue = blob => {
|
|
42
45
|
if (this._isReading) {
|
|
43
46
|
this._queue.push(blob);
|
|
44
47
|
return;
|
|
@@ -46,13 +49,16 @@ class BrowserWebSocket extends Disposable {
|
|
|
46
49
|
this._isReading = true;
|
|
47
50
|
this._fileReader.readAsArrayBuffer(blob);
|
|
48
51
|
};
|
|
49
|
-
this._socketMessageListener =
|
|
52
|
+
this._socketMessageListener = ev => {
|
|
50
53
|
const blob = ev.data;
|
|
51
|
-
this.traceSocketEvent(SocketDiagnosticsEventType.BrowserWebSocketBlobReceived, {
|
|
54
|
+
this.traceSocketEvent(SocketDiagnosticsEventType.BrowserWebSocketBlobReceived, {
|
|
55
|
+
type: blob.type,
|
|
56
|
+
size: blob.size
|
|
57
|
+
});
|
|
52
58
|
enqueue(blob);
|
|
53
59
|
};
|
|
54
|
-
this._socket.addEventListener(
|
|
55
|
-
this._register(addDisposableListener(this._socket,
|
|
60
|
+
this._socket.addEventListener("message", this._socketMessageListener);
|
|
61
|
+
this._register(addDisposableListener(this._socket, "open", e => {
|
|
56
62
|
this.traceSocketEvent(SocketDiagnosticsEventType.Open);
|
|
57
63
|
this._onOpen.fire();
|
|
58
64
|
}));
|
|
@@ -63,45 +69,54 @@ class BrowserWebSocket extends Disposable {
|
|
|
63
69
|
this._onError.fire(err);
|
|
64
70
|
};
|
|
65
71
|
const errorRunner = this._register(( new RunOnceScheduler(sendPendingErrorNow, 0)));
|
|
66
|
-
const sendErrorSoon =
|
|
72
|
+
const sendErrorSoon = err => {
|
|
67
73
|
errorRunner.cancel();
|
|
68
74
|
pendingErrorEvent = err;
|
|
69
75
|
errorRunner.schedule();
|
|
70
76
|
};
|
|
71
|
-
const sendErrorNow =
|
|
77
|
+
const sendErrorNow = err => {
|
|
72
78
|
errorRunner.cancel();
|
|
73
79
|
pendingErrorEvent = err;
|
|
74
80
|
sendPendingErrorNow();
|
|
75
81
|
};
|
|
76
|
-
this._register(addDisposableListener(this._socket,
|
|
77
|
-
this.traceSocketEvent(SocketDiagnosticsEventType.Close, {
|
|
82
|
+
this._register(addDisposableListener(this._socket, "close", e => {
|
|
83
|
+
this.traceSocketEvent(SocketDiagnosticsEventType.Close, {
|
|
84
|
+
code: e.code,
|
|
85
|
+
reason: e.reason,
|
|
86
|
+
wasClean: e.wasClean
|
|
87
|
+
});
|
|
78
88
|
this._isClosed = true;
|
|
79
89
|
if (pendingErrorEvent) {
|
|
80
90
|
if (!mainWindow.navigator.onLine) {
|
|
81
91
|
sendErrorNow(( new RemoteAuthorityResolverError(
|
|
82
|
-
|
|
92
|
+
"Browser is offline",
|
|
83
93
|
RemoteAuthorityResolverErrorCode.TemporarilyNotAvailable,
|
|
84
94
|
e
|
|
85
95
|
)));
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
96
|
+
} else {
|
|
88
97
|
if (!e.wasClean) {
|
|
89
98
|
sendErrorNow(( new RemoteAuthorityResolverError(
|
|
90
99
|
e.reason || `WebSocket close with status code ${e.code}`,
|
|
91
100
|
RemoteAuthorityResolverErrorCode.TemporarilyNotAvailable,
|
|
92
101
|
e
|
|
93
102
|
)));
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
103
|
+
} else {
|
|
96
104
|
errorRunner.cancel();
|
|
97
105
|
sendPendingErrorNow();
|
|
98
106
|
}
|
|
99
107
|
}
|
|
100
108
|
}
|
|
101
|
-
this._onClose.fire({
|
|
109
|
+
this._onClose.fire({
|
|
110
|
+
code: e.code,
|
|
111
|
+
reason: e.reason,
|
|
112
|
+
wasClean: e.wasClean,
|
|
113
|
+
event: e
|
|
114
|
+
});
|
|
102
115
|
}));
|
|
103
|
-
this._register(addDisposableListener(this._socket,
|
|
104
|
-
this.traceSocketEvent(SocketDiagnosticsEventType.Error, {
|
|
116
|
+
this._register(addDisposableListener(this._socket, "error", err => {
|
|
117
|
+
this.traceSocketEvent(SocketDiagnosticsEventType.Error, {
|
|
118
|
+
message: err?.message
|
|
119
|
+
});
|
|
105
120
|
sendErrorSoon(err);
|
|
106
121
|
}));
|
|
107
122
|
}
|
|
@@ -116,7 +131,7 @@ class BrowserWebSocket extends Disposable {
|
|
|
116
131
|
this._isClosed = true;
|
|
117
132
|
this.traceSocketEvent(SocketDiagnosticsEventType.Close);
|
|
118
133
|
this._socket.close();
|
|
119
|
-
this._socket.removeEventListener(
|
|
134
|
+
this._socket.removeEventListener("message", this._socketMessageListener);
|
|
120
135
|
this.dispose();
|
|
121
136
|
}
|
|
122
137
|
}
|
|
@@ -124,13 +139,12 @@ const defaultWebSocketFactory = new class {
|
|
|
124
139
|
create(url, debugLabel) {
|
|
125
140
|
return ( new BrowserWebSocket(url, debugLabel));
|
|
126
141
|
}
|
|
127
|
-
};
|
|
142
|
+
}();
|
|
128
143
|
class BrowserSocket {
|
|
129
144
|
traceSocketEvent(type, data) {
|
|
130
|
-
if (typeof this.socket.traceSocketEvent ===
|
|
145
|
+
if (typeof this.socket.traceSocketEvent === "function") {
|
|
131
146
|
this.socket.traceSocketEvent(type, data);
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
147
|
+
} else {
|
|
134
148
|
SocketDiagnostics.traceSocketEvent(this.socket, this.debugLabel, type, data);
|
|
135
149
|
}
|
|
136
150
|
}
|
|
@@ -142,14 +156,13 @@ class BrowserSocket {
|
|
|
142
156
|
this.socket.close();
|
|
143
157
|
}
|
|
144
158
|
onData(listener) {
|
|
145
|
-
return this.socket.onData(
|
|
159
|
+
return this.socket.onData(data => listener(VSBuffer.wrap(( new Uint8Array(data)))));
|
|
146
160
|
}
|
|
147
161
|
onClose(listener) {
|
|
148
|
-
const adapter =
|
|
149
|
-
if (typeof e ===
|
|
162
|
+
const adapter = e => {
|
|
163
|
+
if (typeof e === "undefined") {
|
|
150
164
|
listener(e);
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
165
|
+
} else {
|
|
153
166
|
listener({
|
|
154
167
|
type: SocketCloseEventType.WebSocketCloseEvent,
|
|
155
168
|
code: e.code,
|
|
@@ -181,10 +194,21 @@ class BrowserSocketFactory {
|
|
|
181
194
|
supports(connectTo) {
|
|
182
195
|
return true;
|
|
183
196
|
}
|
|
184
|
-
connect(
|
|
197
|
+
connect(
|
|
198
|
+
{
|
|
199
|
+
host,
|
|
200
|
+
port
|
|
201
|
+
},
|
|
202
|
+
path,
|
|
203
|
+
query,
|
|
204
|
+
debugLabel
|
|
205
|
+
) {
|
|
185
206
|
return ( new Promise((resolve, reject) => {
|
|
186
|
-
const webSocketSchema = (/^https:/.test(mainWindow.location.href) ?
|
|
187
|
-
const socket = this._webSocketFactory.create(
|
|
207
|
+
const webSocketSchema = (/^https:/.test(mainWindow.location.href) ? "wss" : "ws");
|
|
208
|
+
const socket = this._webSocketFactory.create(
|
|
209
|
+
`${webSocketSchema}://${(/:/.test(host) && !/\[/.test(host)) ? `[${host}]` : host}:${port}${path}?${query}&skipWebSocketFrames=false`,
|
|
210
|
+
debugLabel
|
|
211
|
+
);
|
|
188
212
|
const disposables = ( new DisposableStore());
|
|
189
213
|
disposables.add(socket.onError(reject));
|
|
190
214
|
disposables.add(socket.onOpen(() => {
|
|
@@ -14,7 +14,14 @@ import { getRemoteAuthorityPrefix, WebSocketRemoteConnection, RemoteConnectionTy
|
|
|
14
14
|
import { parseAuthorityWithOptionalPort } from '@codingame/monaco-vscode-api/vscode/vs/platform/remote/common/remoteHosts';
|
|
15
15
|
|
|
16
16
|
let RemoteAuthorityResolverService = class RemoteAuthorityResolverService extends Disposable {
|
|
17
|
-
constructor(
|
|
17
|
+
constructor(
|
|
18
|
+
isWorkbenchOptionsBasedResolution,
|
|
19
|
+
connectionToken,
|
|
20
|
+
resourceUriProvider,
|
|
21
|
+
serverBasePath,
|
|
22
|
+
productService,
|
|
23
|
+
_logService
|
|
24
|
+
) {
|
|
18
25
|
super();
|
|
19
26
|
this._logService = _logService;
|
|
20
27
|
this._onDidChangeConnectionData = this._register(( new Emitter()));
|
|
@@ -35,7 +42,7 @@ let RemoteAuthorityResolverService = class RemoteAuthorityResolverService extend
|
|
|
35
42
|
result = ( new DeferredPromise());
|
|
36
43
|
this._resolveAuthorityRequests.set(authority, result);
|
|
37
44
|
if (this._isWorkbenchOptionsBasedResolution) {
|
|
38
|
-
this._doResolveAuthority(authority).then(v => result.complete(v),
|
|
45
|
+
this._doResolveAuthority(authority).then(v => result.complete(v), err => result.error(err));
|
|
39
46
|
}
|
|
40
47
|
}
|
|
41
48
|
return result.p;
|
|
@@ -63,8 +70,17 @@ let RemoteAuthorityResolverService = class RemoteAuthorityResolverService extend
|
|
|
63
70
|
mark(`code/didResolveConnectionToken/${authorityPrefix}`);
|
|
64
71
|
this._logService.info(`Resolved connection token (${authorityPrefix}) after ${sw.elapsed()} ms`);
|
|
65
72
|
const defaultPort = (/^https:/.test(mainWindow.location.href) ? 443 : 80);
|
|
66
|
-
const {
|
|
67
|
-
|
|
73
|
+
const {
|
|
74
|
+
host,
|
|
75
|
+
port
|
|
76
|
+
} = parseAuthorityWithOptionalPort(authority, defaultPort);
|
|
77
|
+
const result = {
|
|
78
|
+
authority: {
|
|
79
|
+
authority,
|
|
80
|
+
connectTo: ( new WebSocketRemoteConnection(host, port)),
|
|
81
|
+
connectionToken
|
|
82
|
+
}
|
|
83
|
+
};
|
|
68
84
|
RemoteAuthorities.set(authority, host, port);
|
|
69
85
|
this._cache.set(authority, result);
|
|
70
86
|
this._onDidChangeConnectionData.fire();
|
|
@@ -80,12 +96,19 @@ let RemoteAuthorityResolverService = class RemoteAuthorityResolverService extend
|
|
|
80
96
|
if (( this._resolveAuthorityRequests.has(resolvedAuthority.authority))) {
|
|
81
97
|
const request = this._resolveAuthorityRequests.get(resolvedAuthority.authority);
|
|
82
98
|
if (resolvedAuthority.connectTo.type === RemoteConnectionType.WebSocket) {
|
|
83
|
-
RemoteAuthorities.set(
|
|
99
|
+
RemoteAuthorities.set(
|
|
100
|
+
resolvedAuthority.authority,
|
|
101
|
+
resolvedAuthority.connectTo.host,
|
|
102
|
+
resolvedAuthority.connectTo.port
|
|
103
|
+
);
|
|
84
104
|
}
|
|
85
105
|
if (resolvedAuthority.connectionToken) {
|
|
86
106
|
RemoteAuthorities.setConnectionToken(resolvedAuthority.authority, resolvedAuthority.connectionToken);
|
|
87
107
|
}
|
|
88
|
-
request.complete({
|
|
108
|
+
request.complete({
|
|
109
|
+
authority: resolvedAuthority,
|
|
110
|
+
options
|
|
111
|
+
});
|
|
89
112
|
this._onDidChangeConnectionData.fire();
|
|
90
113
|
}
|
|
91
114
|
}
|
|
@@ -100,12 +123,8 @@ let RemoteAuthorityResolverService = class RemoteAuthorityResolverService extend
|
|
|
100
123
|
RemoteAuthorities.setConnectionToken(authority, connectionToken);
|
|
101
124
|
this._onDidChangeConnectionData.fire();
|
|
102
125
|
}
|
|
103
|
-
_setCanonicalURIProvider(provider) {
|
|
104
|
-
}
|
|
126
|
+
_setCanonicalURIProvider(provider) {}
|
|
105
127
|
};
|
|
106
|
-
RemoteAuthorityResolverService = ( __decorate([
|
|
107
|
-
( __param(4, IProductService)),
|
|
108
|
-
( __param(5, ILogService))
|
|
109
|
-
], RemoteAuthorityResolverService));
|
|
128
|
+
RemoteAuthorityResolverService = ( __decorate([( __param(4, IProductService)), ( __param(5, ILogService))], RemoteAuthorityResolverService));
|
|
110
129
|
|
|
111
130
|
export { RemoteAuthorityResolverService };
|
|
@@ -10,7 +10,7 @@ class RemoteSocketFactoryService {
|
|
|
10
10
|
this.factories[type].push(factory);
|
|
11
11
|
return toDisposable(() => {
|
|
12
12
|
const idx = this.factories[type]?.indexOf(factory);
|
|
13
|
-
if (typeof idx ===
|
|
13
|
+
if (typeof idx === "number" && idx >= 0) {
|
|
14
14
|
this.factories[type]?.splice(idx, 1);
|
|
15
15
|
}
|
|
16
16
|
});
|
|
@@ -15,9 +15,15 @@ import { getVirtualWorkspaceLocation } from '@codingame/monaco-vscode-api/vscode
|
|
|
15
15
|
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
16
16
|
import { Disposable, DisposableMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
17
17
|
|
|
18
|
-
const SELECTED_REMOTE_IN_EXPLORER = ( new RawContextKey(
|
|
18
|
+
const SELECTED_REMOTE_IN_EXPLORER = ( new RawContextKey("selectedRemoteInExplorer", ""));
|
|
19
19
|
let SwitchRemoteViewItem = class SwitchRemoteViewItem extends Disposable {
|
|
20
|
-
constructor(
|
|
20
|
+
constructor(
|
|
21
|
+
contextKeyService,
|
|
22
|
+
remoteExplorerService,
|
|
23
|
+
environmentService,
|
|
24
|
+
storageService,
|
|
25
|
+
workspaceContextService
|
|
26
|
+
) {
|
|
21
27
|
super();
|
|
22
28
|
this.contextKeyService = contextKeyService;
|
|
23
29
|
this.remoteExplorerService = remoteExplorerService;
|
|
@@ -26,12 +32,12 @@ let SwitchRemoteViewItem = class SwitchRemoteViewItem extends Disposable {
|
|
|
26
32
|
this.workspaceContextService = workspaceContextService;
|
|
27
33
|
this.completedRemotes = this._register(( new DisposableMap()));
|
|
28
34
|
this.selectedRemoteContext = SELECTED_REMOTE_IN_EXPLORER.bindTo(contextKeyService);
|
|
29
|
-
this.switchRemoteMenu = MenuId.for(
|
|
35
|
+
this.switchRemoteMenu = MenuId.for("workbench.remote.menu.switchRemoteMenu");
|
|
30
36
|
this._register(MenuRegistry.appendMenuItem(MenuId.ViewContainerTitle, {
|
|
31
37
|
submenu: this.switchRemoteMenu,
|
|
32
|
-
title: ( localize(
|
|
33
|
-
group:
|
|
34
|
-
when: ( ContextKeyExpr.equals(
|
|
38
|
+
title: ( localize(10547, "Switch Remote")),
|
|
39
|
+
group: "navigation",
|
|
40
|
+
when: ( ContextKeyExpr.equals("viewContainer", VIEWLET_ID)),
|
|
35
41
|
order: 1,
|
|
36
42
|
isSelection: true
|
|
37
43
|
}));
|
|
@@ -49,9 +55,7 @@ let SwitchRemoteViewItem = class SwitchRemoteViewItem extends Disposable {
|
|
|
49
55
|
virtualWorkspace = getVirtualWorkspaceLocation(this.workspaceContextService.getWorkspace())?.scheme;
|
|
50
56
|
}
|
|
51
57
|
isSetForConnection = true;
|
|
52
|
-
const explorerType = remoteAuthority ? [remoteAuthority.split(
|
|
53
|
-
: (virtualWorkspace ? [virtualWorkspace]
|
|
54
|
-
: (this.storageService.get(REMOTE_EXPLORER_TYPE_KEY, StorageScope.WORKSPACE)?.split(',') ?? this.storageService.get(REMOTE_EXPLORER_TYPE_KEY, StorageScope.PROFILE)?.split(',')));
|
|
58
|
+
const explorerType = remoteAuthority ? [remoteAuthority.split("+")[0]] : (virtualWorkspace ? [virtualWorkspace] : (this.storageService.get(REMOTE_EXPLORER_TYPE_KEY, StorageScope.WORKSPACE)?.split(",") ?? this.storageService.get(REMOTE_EXPLORER_TYPE_KEY, StorageScope.PROFILE)?.split(",")));
|
|
55
59
|
if (explorerType !== undefined) {
|
|
56
60
|
authority = this.getAuthorityForExplorerType(explorerType);
|
|
57
61
|
}
|
|
@@ -73,8 +77,7 @@ let SwitchRemoteViewItem = class SwitchRemoteViewItem extends Disposable {
|
|
|
73
77
|
if (authorityOption === explorerOption) {
|
|
74
78
|
authority = option[1].authority;
|
|
75
79
|
break;
|
|
76
|
-
}
|
|
77
|
-
else if (option[1].virtualWorkspace === explorerOption) {
|
|
80
|
+
} else if (option[1].virtualWorkspace === explorerOption) {
|
|
78
81
|
authority = option[1].authority;
|
|
79
82
|
break;
|
|
80
83
|
}
|
|
@@ -85,7 +88,7 @@ let SwitchRemoteViewItem = class SwitchRemoteViewItem extends Disposable {
|
|
|
85
88
|
}
|
|
86
89
|
removeOptionItems(views) {
|
|
87
90
|
for (const view of views) {
|
|
88
|
-
if (view.group && view.group.startsWith(
|
|
91
|
+
if (view.group && view.group.startsWith("targets") && view.remoteAuthority && (!view.when || this.contextKeyService.contextMatchesRules(view.when))) {
|
|
89
92
|
const authority = isStringArray(view.remoteAuthority) ? view.remoteAuthority : [view.remoteAuthority];
|
|
90
93
|
this.completedRemotes.deleteAndDispose(authority[0]);
|
|
91
94
|
}
|
|
@@ -94,7 +97,7 @@ let SwitchRemoteViewItem = class SwitchRemoteViewItem extends Disposable {
|
|
|
94
97
|
createOptionItems(views) {
|
|
95
98
|
const startingCount = this.completedRemotes.size;
|
|
96
99
|
for (const view of views) {
|
|
97
|
-
if (view.group && view.group.startsWith(
|
|
100
|
+
if (view.group && view.group.startsWith("targets") && view.remoteAuthority && (!view.when || this.contextKeyService.contextMatchesRules(view.when))) {
|
|
98
101
|
const text = view.name;
|
|
99
102
|
const authority = isStringArray(view.remoteAuthority) ? view.remoteAuthority : [view.remoteAuthority];
|
|
100
103
|
if (( this.completedRemotes.has(authority[0]))) {
|
|
@@ -116,7 +119,12 @@ let SwitchRemoteViewItem = class SwitchRemoteViewItem extends Disposable {
|
|
|
116
119
|
thisCapture.select(authority);
|
|
117
120
|
}
|
|
118
121
|
});
|
|
119
|
-
this.completedRemotes.set(authority[0], {
|
|
122
|
+
this.completedRemotes.set(authority[0], {
|
|
123
|
+
text: text.value,
|
|
124
|
+
authority,
|
|
125
|
+
virtualWorkspace: view.virtualWorkspace,
|
|
126
|
+
dispose: () => action.dispose()
|
|
127
|
+
});
|
|
120
128
|
}
|
|
121
129
|
}
|
|
122
130
|
if (this.completedRemotes.size > startingCount) {
|
|
@@ -124,12 +132,6 @@ let SwitchRemoteViewItem = class SwitchRemoteViewItem extends Disposable {
|
|
|
124
132
|
}
|
|
125
133
|
}
|
|
126
134
|
};
|
|
127
|
-
SwitchRemoteViewItem = ( __decorate([
|
|
128
|
-
( __param(0, IContextKeyService)),
|
|
129
|
-
( __param(1, IRemoteExplorerService)),
|
|
130
|
-
( __param(2, IWorkbenchEnvironmentService)),
|
|
131
|
-
( __param(3, IStorageService)),
|
|
132
|
-
( __param(4, IWorkspaceContextService))
|
|
133
|
-
], SwitchRemoteViewItem));
|
|
135
|
+
SwitchRemoteViewItem = ( __decorate([( __param(0, IContextKeyService)), ( __param(1, IRemoteExplorerService)), ( __param(2, IWorkbenchEnvironmentService)), ( __param(3, IStorageService)), ( __param(4, IWorkspaceContextService))], SwitchRemoteViewItem));
|
|
134
136
|
|
|
135
137
|
export { SELECTED_REMOTE_IN_EXPLORER, SwitchRemoteViewItem };
|