@theia/plugin-ext 1.22.0-next.6 → 1.22.0
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/lib/common/plugin-api-rpc.d.ts +4 -3
- package/lib/common/plugin-api-rpc.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc.js.map +1 -1
- package/lib/common/plugin-protocol.d.ts +5 -0
- package/lib/common/plugin-protocol.d.ts.map +1 -1
- package/lib/common/plugin-protocol.js.map +1 -1
- package/lib/main/browser/comments/comments-context-key-service.js +1 -1
- package/lib/main/browser/comments/comments-context-key-service.js.map +1 -1
- package/lib/main/browser/comments/comments-contribution.js +1 -1
- package/lib/main/browser/comments/comments-contribution.js.map +1 -1
- package/lib/main/browser/custom-editors/custom-editor-opener.d.ts +3 -3
- package/lib/main/browser/custom-editors/custom-editor-opener.d.ts.map +1 -1
- package/lib/main/browser/custom-editors/custom-editor-opener.js +1 -1
- package/lib/main/browser/custom-editors/custom-editor-opener.js.map +1 -1
- package/lib/main/browser/custom-editors/custom-editors-main.d.ts +3 -3
- package/lib/main/browser/custom-editors/custom-editors-main.d.ts.map +1 -1
- package/lib/main/browser/custom-editors/custom-editors-main.js +34 -6
- package/lib/main/browser/custom-editors/custom-editors-main.js.map +1 -1
- package/lib/main/browser/custom-editors/plugin-custom-editor-registry.d.ts +3 -3
- package/lib/main/browser/custom-editors/plugin-custom-editor-registry.d.ts.map +1 -1
- package/lib/main/browser/custom-editors/plugin-custom-editor-registry.js +3 -3
- package/lib/main/browser/custom-editors/plugin-custom-editor-registry.js.map +1 -1
- package/lib/main/browser/debug/debug-main.d.ts +1 -0
- package/lib/main/browser/debug/debug-main.d.ts.map +1 -1
- package/lib/main/browser/debug/debug-main.js +12 -2
- package/lib/main/browser/debug/debug-main.js.map +1 -1
- package/lib/main/browser/menus/menus-contribution-handler.d.ts.map +1 -1
- package/lib/main/browser/menus/menus-contribution-handler.js +4 -6
- package/lib/main/browser/menus/menus-contribution-handler.js.map +1 -1
- package/lib/main/browser/view/plugin-view-registry.js +1 -1
- package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
- package/lib/main/browser/view/plugin-view-widget.d.ts +5 -3
- package/lib/main/browser/view/plugin-view-widget.d.ts.map +1 -1
- package/lib/main/browser/view/plugin-view-widget.js +12 -4
- package/lib/main/browser/view/plugin-view-widget.js.map +1 -1
- package/lib/main/browser/view/tree-view-widget.d.ts +1 -2
- package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
- package/lib/main/browser/view/tree-view-widget.js +5 -6
- package/lib/main/browser/view/tree-view-widget.js.map +1 -1
- package/lib/main/browser/view/view-context-key-service.d.ts +0 -4
- package/lib/main/browser/view/view-context-key-service.d.ts.map +1 -1
- package/lib/main/browser/view/view-context-key-service.js +1 -14
- package/lib/main/browser/view/view-context-key-service.js.map +1 -1
- package/lib/main/electron-browser/webview/electron-webview-widget-factory.js +3 -3
- package/lib/main/electron-browser/webview/electron-webview-widget-factory.js.map +1 -1
- package/lib/main/node/plugin-deployer-impl.d.ts +6 -9
- package/lib/main/node/plugin-deployer-impl.d.ts.map +1 -1
- package/lib/main/node/plugin-deployer-impl.js +32 -24
- package/lib/main/node/plugin-deployer-impl.js.map +1 -1
- package/lib/main/node/plugin-server-handler.d.ts +2 -2
- package/lib/main/node/plugin-server-handler.d.ts.map +1 -1
- package/lib/main/node/plugin-server-handler.js +6 -3
- package/lib/main/node/plugin-server-handler.js.map +1 -1
- package/lib/plugin/custom-editors.d.ts +2 -1
- package/lib/plugin/custom-editors.d.ts.map +1 -1
- package/lib/plugin/custom-editors.js +2 -4
- package/lib/plugin/custom-editors.js.map +1 -1
- package/lib/plugin/node/debug/debug.d.ts +1 -0
- package/lib/plugin/node/debug/debug.d.ts.map +1 -1
- package/lib/plugin/node/debug/debug.js +3 -0
- package/lib/plugin/node/debug/debug.js.map +1 -1
- package/lib/plugin/plugin-context.d.ts +50 -2
- package/lib/plugin/plugin-context.d.ts.map +1 -1
- package/lib/plugin/plugin-context.js +37 -6
- package/lib/plugin/plugin-context.js.map +1 -1
- package/lib/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/plugin/plugin-manager.js +4 -1
- package/lib/plugin/plugin-manager.js.map +1 -1
- package/lib/plugin/types-impl.js +1 -1
- package/lib/plugin/types-impl.js.map +1 -1
- package/lib/plugin/types-impl.spec.js +33 -0
- package/lib/plugin/types-impl.spec.js.map +1 -1
- package/package.json +24 -26
- package/src/common/plugin-api-rpc.ts +4 -3
- package/src/common/plugin-protocol.ts +7 -1
- package/src/main/browser/custom-editors/custom-editor-opener.tsx +4 -4
- package/src/main/browser/custom-editors/custom-editors-main.ts +41 -8
- package/src/main/browser/custom-editors/plugin-custom-editor-registry.ts +6 -6
- package/src/main/browser/debug/debug-main.ts +13 -3
- package/src/main/browser/menus/menus-contribution-handler.ts +3 -7
- package/src/main/browser/view/plugin-view-widget.ts +14 -4
- package/src/main/browser/view/tree-view-widget.tsx +4 -5
- package/src/main/browser/view/view-context-key-service.ts +0 -14
- package/src/main/electron-browser/webview/electron-webview-widget-factory.ts +3 -3
- package/src/main/node/plugin-deployer-impl.ts +38 -27
- package/src/main/node/plugin-server-handler.ts +8 -4
- package/src/plugin/custom-editors.ts +3 -4
- package/src/plugin/node/debug/debug.ts +4 -0
- package/src/plugin/plugin-context.ts +73 -8
- package/src/plugin/plugin-manager.ts +4 -1
- package/src/plugin/types-impl.spec.ts +37 -1
- package/src/plugin/types-impl.ts +1 -1
|
@@ -18,7 +18,7 @@ import { injectable, inject } from '@theia/core/shared/inversify';
|
|
|
18
18
|
import { CancellationToken } from '@theia/core/lib/common/cancellation';
|
|
19
19
|
import { PluginDeployerImpl } from './plugin-deployer-impl';
|
|
20
20
|
import { PluginsKeyValueStorage } from './plugins-key-value-storage';
|
|
21
|
-
import { PluginServer, PluginDeployer, PluginStorageKind, PluginType } from '../../common/plugin-protocol';
|
|
21
|
+
import { PluginServer, PluginDeployer, PluginStorageKind, PluginType, UnresolvedPluginEntry } from '../../common/plugin-protocol';
|
|
22
22
|
import { KeysToAnyValues, KeysToKeysToAnyValue } from '../../common/types';
|
|
23
23
|
|
|
24
24
|
@injectable()
|
|
@@ -32,10 +32,14 @@ export class PluginServerHandler implements PluginServer {
|
|
|
32
32
|
|
|
33
33
|
deploy(pluginEntry: string, arg2?: PluginType | CancellationToken): Promise<void> {
|
|
34
34
|
const type = typeof arg2 === 'number' ? arg2 as PluginType : undefined;
|
|
35
|
-
return this.doDeploy(
|
|
35
|
+
return this.doDeploy({
|
|
36
|
+
id: pluginEntry,
|
|
37
|
+
type: type ?? PluginType.User
|
|
38
|
+
});
|
|
36
39
|
}
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
|
|
41
|
+
protected doDeploy(pluginEntry: UnresolvedPluginEntry): Promise<void> {
|
|
42
|
+
return this.pluginDeployer.deploy(pluginEntry);
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
undeploy(pluginId: string): Promise<void> {
|
|
@@ -29,7 +29,7 @@ import { WebviewImpl, WebviewsExtImpl } from './webviews';
|
|
|
29
29
|
import { CancellationToken, CancellationTokenSource } from '@theia/core/lib/common/cancellation';
|
|
30
30
|
import { DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
31
31
|
import { WorkspaceExtImpl } from './workspace';
|
|
32
|
-
import
|
|
32
|
+
import { WidgetOpenerOptions } from '@theia/core/lib/browser';
|
|
33
33
|
|
|
34
34
|
export class CustomEditorsExtImpl implements CustomEditorsExt {
|
|
35
35
|
private readonly proxy: CustomEditorsMain;
|
|
@@ -121,7 +121,7 @@ export class CustomEditorsExtImpl implements CustomEditorsExt {
|
|
|
121
121
|
handler: string,
|
|
122
122
|
viewType: string,
|
|
123
123
|
title: string,
|
|
124
|
-
|
|
124
|
+
widgetOpenerOptions: WidgetOpenerOptions | undefined,
|
|
125
125
|
options: theia.WebviewPanelOptions & theia.WebviewOptions,
|
|
126
126
|
cancellation: CancellationToken
|
|
127
127
|
): Promise<void> {
|
|
@@ -129,10 +129,9 @@ export class CustomEditorsExtImpl implements CustomEditorsExt {
|
|
|
129
129
|
if (!entry) {
|
|
130
130
|
throw new Error(`No provider found for '${viewType}'`);
|
|
131
131
|
}
|
|
132
|
-
const viewColumn = Converters.toViewColumn(position);
|
|
133
132
|
const panel = this.webviewExt.createWebviewPanel(viewType, title, {}, options, entry.plugin, handler);
|
|
134
133
|
const webviewOptions = WebviewImpl.toWebviewOptions(options, this.workspace, entry.plugin);
|
|
135
|
-
await this.proxy.$createCustomEditorPanel(handler, title,
|
|
134
|
+
await this.proxy.$createCustomEditorPanel(handler, title, widgetOpenerOptions, webviewOptions);
|
|
136
135
|
|
|
137
136
|
const revivedResource = URI.revive(resource);
|
|
138
137
|
|
|
@@ -168,6 +168,10 @@ export class DebugExtImpl implements DebugExt {
|
|
|
168
168
|
return this.proxy.$startDebugging(folder, nameOrConfiguration, options);
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
stopDebugging(session?: theia.DebugSession): PromiseLike<void> {
|
|
172
|
+
return this.proxy.$stopDebugging(session?.id);
|
|
173
|
+
}
|
|
174
|
+
|
|
171
175
|
registerDebugAdapterDescriptorFactory(debugType: string, factory: theia.DebugAdapterDescriptorFactory): Disposable {
|
|
172
176
|
if (this.descriptorFactories.has(debugType)) {
|
|
173
177
|
throw new Error(`Descriptor factory for ${debugType} has been already registered`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (C) 2018 Red Hat, Inc. and others.
|
|
2
|
+
* Copyright (C) 2018-2022 Red Hat, Inc. and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -724,13 +724,13 @@ export function createAPIFactory(
|
|
|
724
724
|
const plugins: typeof theia.plugins = {
|
|
725
725
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
726
726
|
get all(): theia.Plugin<any>[] {
|
|
727
|
-
return pluginManager.getAllPlugins().map(plg => new
|
|
727
|
+
return pluginManager.getAllPlugins().map(plg => new PluginExt(pluginManager, plg));
|
|
728
728
|
},
|
|
729
729
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
730
730
|
getPlugin(pluginId: string): theia.Plugin<any> | undefined {
|
|
731
731
|
const plg = pluginManager.getPluginById(pluginId.toLowerCase());
|
|
732
732
|
if (plg) {
|
|
733
|
-
return new
|
|
733
|
+
return new PluginExt(pluginManager, plg);
|
|
734
734
|
}
|
|
735
735
|
return undefined;
|
|
736
736
|
},
|
|
@@ -780,9 +780,18 @@ export function createAPIFactory(
|
|
|
780
780
|
registerDebugAdapterTrackerFactory(debugType: string, factory: theia.DebugAdapterTrackerFactory): Disposable {
|
|
781
781
|
return debugExt.registerDebugAdapterTrackerFactory(debugType, factory);
|
|
782
782
|
},
|
|
783
|
-
startDebugging(
|
|
784
|
-
|
|
785
|
-
|
|
783
|
+
startDebugging(
|
|
784
|
+
folder: theia.WorkspaceFolder | undefined,
|
|
785
|
+
nameOrConfiguration: string | theia.DebugConfiguration,
|
|
786
|
+
parentSessionOrOptions?: theia.DebugSession | theia.DebugSessionOptions
|
|
787
|
+
): Thenable<boolean> {
|
|
788
|
+
if (!parentSessionOrOptions || (typeof parentSessionOrOptions === 'object' && 'configuration' in parentSessionOrOptions)) {
|
|
789
|
+
return debugExt.startDebugging(folder, nameOrConfiguration, { parentSession: parentSessionOrOptions });
|
|
790
|
+
}
|
|
791
|
+
return debugExt.startDebugging(folder, nameOrConfiguration, parentSessionOrOptions || {});
|
|
792
|
+
},
|
|
793
|
+
stopDebugging(session?: theia.DebugSession): Thenable<void> {
|
|
794
|
+
return debugExt.stopDebugging(session);
|
|
786
795
|
},
|
|
787
796
|
addBreakpoints(breakpoints: theia.Breakpoint[]): void {
|
|
788
797
|
debugExt.addBreakpoints(breakpoints);
|
|
@@ -969,14 +978,44 @@ export function createAPIFactory(
|
|
|
969
978
|
};
|
|
970
979
|
}
|
|
971
980
|
|
|
972
|
-
|
|
981
|
+
export enum ExtensionKind {
|
|
982
|
+
UI = 1,
|
|
983
|
+
Workspace = 2
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* Represents a Theia plugin as well as a VSCode extension.
|
|
988
|
+
*/
|
|
989
|
+
export interface ExtensionPlugin<T> extends theia.Plugin<T> {
|
|
990
|
+
/**
|
|
991
|
+
* The uri of the directory containing the extension. Same as {@linkcode theia.Plugin.pluginUri}.
|
|
992
|
+
*/
|
|
993
|
+
readonly extensionUri: theia.Uri;
|
|
994
|
+
|
|
995
|
+
/**
|
|
996
|
+
* The absolute file path of the directory containing this extension.
|
|
997
|
+
* Same as {@linkcode theia.Plugin.pluginPath}.
|
|
998
|
+
*/
|
|
999
|
+
readonly extensionPath: string;
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* The extension kind describes if an extension runs where the UI runs
|
|
1003
|
+
* or if an extension runs where the remote extension host runs. The extension kind
|
|
1004
|
+
* is defined in the `package.json`-file of extensions. When no remote extension host exists,
|
|
1005
|
+
* the value is {@linkcode ExtensionKind.UI}.
|
|
1006
|
+
*/
|
|
1007
|
+
extensionKind: ExtensionKind;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
export class Plugin<T> implements theia.Plugin<T> {
|
|
973
1011
|
id: string;
|
|
974
1012
|
pluginPath: string;
|
|
975
1013
|
pluginUri: theia.Uri;
|
|
976
1014
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
977
1015
|
packageJSON: any;
|
|
978
1016
|
pluginType: theia.PluginType;
|
|
979
|
-
|
|
1017
|
+
|
|
1018
|
+
constructor(protected readonly pluginManager: PluginManager, plugin: InternalPlugin) {
|
|
980
1019
|
this.id = plugin.model.id;
|
|
981
1020
|
this.pluginPath = plugin.pluginFolder;
|
|
982
1021
|
this.pluginUri = URI.parse(plugin.pluginUri);
|
|
@@ -996,3 +1035,29 @@ class Plugin<T> implements theia.Plugin<T> {
|
|
|
996
1035
|
return this.pluginManager.activatePlugin(this.id).then(() => this.exports);
|
|
997
1036
|
}
|
|
998
1037
|
}
|
|
1038
|
+
|
|
1039
|
+
export class PluginExt<T> extends Plugin<T> implements ExtensionPlugin<T> {
|
|
1040
|
+
extensionPath: string;
|
|
1041
|
+
extensionUri: theia.Uri;
|
|
1042
|
+
extensionKind: ExtensionKind;
|
|
1043
|
+
|
|
1044
|
+
constructor(protected readonly pluginManager: PluginManager, plugin: InternalPlugin) {
|
|
1045
|
+
super(pluginManager, plugin);
|
|
1046
|
+
|
|
1047
|
+
this.extensionPath = this.pluginPath;
|
|
1048
|
+
this.extensionUri = this.pluginUri;
|
|
1049
|
+
this.extensionKind = ExtensionKind.UI; // stub as a local extension (not running on a remote workspace)
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
get isActive(): boolean {
|
|
1053
|
+
return this.pluginManager.isActive(this.id);
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
get exports(): T {
|
|
1057
|
+
return <T>this.pluginManager.getPluginExport(this.id);
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
activate(): PromiseLike<T> {
|
|
1061
|
+
return this.pluginManager.activatePlugin(this.id).then(() => this.exports);
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
@@ -40,6 +40,7 @@ import { Emitter } from '@theia/core/lib/common/event';
|
|
|
40
40
|
import { WebviewsExtImpl } from './webviews';
|
|
41
41
|
import { URI as Uri } from './types-impl';
|
|
42
42
|
import { SecretsExtImpl, SecretStorageExt } from '../plugin/secrets-ext';
|
|
43
|
+
import { PluginExt } from './plugin-context';
|
|
43
44
|
|
|
44
45
|
export interface PluginHost {
|
|
45
46
|
|
|
@@ -383,7 +384,9 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
|
|
|
383
384
|
globalStoragePath: globalStoragePath,
|
|
384
385
|
globalStorageUri: Uri.file(globalStoragePath),
|
|
385
386
|
environmentVariableCollection: this.terminalService.getEnvironmentVariableCollection(plugin.model.id),
|
|
386
|
-
extensionMode: 1 // @todo: implement proper `extensionMode`.
|
|
387
|
+
extensionMode: 1, // @todo: implement proper `extensionMode`.
|
|
388
|
+
extension: new PluginExt(this, plugin),
|
|
389
|
+
logUri: Uri.file(logPath)
|
|
387
390
|
};
|
|
388
391
|
this.pluginContextsMap.set(plugin.model.id, pluginContext);
|
|
389
392
|
|
|
@@ -14,13 +14,14 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
|
+
import { isWindows } from '@theia/core';
|
|
17
18
|
import * as assert from 'assert';
|
|
18
19
|
import * as types from './types-impl';
|
|
19
20
|
|
|
20
21
|
describe('API Type Implementations:', () => {
|
|
21
22
|
|
|
22
23
|
describe('URI:', () => {
|
|
23
|
-
|
|
24
|
+
it('should convert to string', () => {
|
|
24
25
|
const uriString = 'scheme://authority.com/foo/bar/zoz?query#fragment';
|
|
25
26
|
const uri = types.URI.parse(uriString);
|
|
26
27
|
// when
|
|
@@ -29,5 +30,40 @@ describe('API Type Implementations:', () => {
|
|
|
29
30
|
// then
|
|
30
31
|
assert.strictEqual(result, uriString);
|
|
31
32
|
});
|
|
33
|
+
|
|
34
|
+
// Issue: #10370
|
|
35
|
+
it('should returns correct path while using joinPath()', () => {
|
|
36
|
+
if (isWindows) {
|
|
37
|
+
assert.strictEqual(types.URI.joinPath(types.URI.file('c:\\foo\\bar'), '/file.js').toString(), 'file:///c%3A/foo/bar/file.js');
|
|
38
|
+
assert.strictEqual(types.URI.joinPath(types.URI.file('c:\\foo\\bar\\'), 'file.js').toString(), 'file:///c%3A/foo/bar/file.js');
|
|
39
|
+
assert.strictEqual(types.URI.joinPath(types.URI.file('c:\\foo\\bar\\'), '/file.js').toString(), 'file:///c%3A/foo/bar/file.js');
|
|
40
|
+
assert.strictEqual(types.URI.joinPath(types.URI.file('c:\\'), '/file.js').toString(), 'file:///c%3A/file.js');
|
|
41
|
+
assert.strictEqual(types.URI.joinPath(types.URI.file('c:\\'), 'bar/file.js').toString(), 'file:///c%3A/bar/file.js');
|
|
42
|
+
assert.strictEqual(types.URI.joinPath(types.URI.file('c:\\foo'), './file.js').toString(), 'file:///c%3A/foo/file.js');
|
|
43
|
+
assert.strictEqual(types.URI.joinPath(types.URI.file('c:\\foo'), '/./file.js').toString(), 'file:///c%3A/foo/file.js');
|
|
44
|
+
assert.strictEqual(types.URI.joinPath(types.URI.file('C:\\foo'), '../file.js').toString(), 'file:///c%3A/file.js');
|
|
45
|
+
assert.strictEqual(types.URI.joinPath(types.URI.file('C:\\foo\\.'), '../file.js').toString(), 'file:///c%3A/file.js');
|
|
46
|
+
} else {
|
|
47
|
+
assert.strictEqual(types.URI.joinPath(types.URI.file('/foo/bar'), '/file.js').toString(), 'file:///foo/bar/file.js');
|
|
48
|
+
assert.strictEqual(types.URI.joinPath(types.URI.file('/foo/bar'), 'file.js').toString(), 'file:///foo/bar/file.js');
|
|
49
|
+
assert.strictEqual(types.URI.joinPath(types.URI.file('/foo/bar/'), '/file.js').toString(), 'file:///foo/bar/file.js');
|
|
50
|
+
assert.strictEqual(types.URI.joinPath(types.URI.file('/'), '/file.js').toString(), 'file:///file.js');
|
|
51
|
+
assert.strictEqual(types.URI.joinPath(types.URI.file('/foo/bar'), './file.js').toString(), 'file:///foo/bar/file.js');
|
|
52
|
+
assert.strictEqual(types.URI.joinPath(types.URI.file('/foo/bar'), '/./file.js').toString(), 'file:///foo/bar/file.js');
|
|
53
|
+
assert.strictEqual(types.URI.joinPath(types.URI.file('/foo/bar'), '../file.js').toString(), 'file:///foo/file.js');
|
|
54
|
+
}
|
|
55
|
+
assert.strictEqual(types.URI.joinPath(types.URI.parse('foo://a/foo/bar')).toString(), 'foo://a/foo/bar');
|
|
56
|
+
assert.strictEqual(types.URI.joinPath(types.URI.parse('foo://a/foo/bar'), '/file.js').toString(), 'foo://a/foo/bar/file.js');
|
|
57
|
+
assert.strictEqual(types.URI.joinPath(types.URI.parse('foo://a/foo/bar'), 'file.js').toString(), 'foo://a/foo/bar/file.js');
|
|
58
|
+
assert.strictEqual(types.URI.joinPath(types.URI.parse('foo://a/foo/bar/'), '/file.js').toString(), 'foo://a/foo/bar/file.js');
|
|
59
|
+
assert.strictEqual(types.URI.joinPath(types.URI.parse('foo://a/'), '/file.js').toString(), 'foo://a/file.js');
|
|
60
|
+
assert.strictEqual(types.URI.joinPath(types.URI.parse('foo://a/foo/bar/'), './file.js').toString(), 'foo://a/foo/bar/file.js');
|
|
61
|
+
assert.strictEqual(types.URI.joinPath(types.URI.parse('foo://a/foo/bar/'), '/./file.js').toString(), 'foo://a/foo/bar/file.js');
|
|
62
|
+
assert.strictEqual(types.URI.joinPath(types.URI.parse('foo://a/foo/bar/'), '../file.js').toString(), 'foo://a/foo/file.js');
|
|
63
|
+
|
|
64
|
+
assert.strictEqual(
|
|
65
|
+
types.URI.joinPath(types.URI.from({ scheme: 'myScheme', authority: 'authority', path: '/path', query: 'query', fragment: 'fragment' }), '/file.js').toString(),
|
|
66
|
+
'myScheme://authority/path/file.js?query#fragment');
|
|
67
|
+
});
|
|
32
68
|
});
|
|
33
69
|
});
|
package/src/plugin/types-impl.ts
CHANGED
|
@@ -82,7 +82,7 @@ export class URI extends CodeURI implements theia.Uri {
|
|
|
82
82
|
if (!uri.path) {
|
|
83
83
|
throw new Error('\'joinPath\' called on URI without path');
|
|
84
84
|
}
|
|
85
|
-
const newPath = paths.
|
|
85
|
+
const newPath = paths.posix.join(uri.path, ...pathSegments);
|
|
86
86
|
return new URI(uri.scheme, uri.authority, newPath, uri.query, uri.fragment);
|
|
87
87
|
}
|
|
88
88
|
|