@theia/plugin-ext 1.33.0 → 1.34.0-next.19
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/collections.d.ts +5 -0
- package/lib/common/collections.d.ts.map +1 -0
- package/lib/common/collections.js +40 -0
- package/lib/common/collections.js.map +1 -0
- package/lib/common/plugin-api-rpc-model.d.ts +2 -0
- package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc-model.js.map +1 -1
- package/lib/common/plugin-api-rpc.d.ts +103 -1
- package/lib/common/plugin-api-rpc.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc.js +12 -8
- package/lib/common/plugin-api-rpc.js.map +1 -1
- package/lib/common/rpc-protocol.d.ts.map +1 -1
- package/lib/common/rpc-protocol.js +3 -4
- package/lib/common/rpc-protocol.js.map +1 -1
- package/lib/common/types.d.ts +5 -1
- package/lib/common/types.d.ts.map +1 -1
- package/lib/common/types.js +13 -4
- package/lib/common/types.js.map +1 -1
- package/lib/hosted/node/hosted-plugin-localization-service.d.ts.map +1 -1
- package/lib/hosted/node/hosted-plugin-localization-service.js +2 -2
- package/lib/hosted/node/hosted-plugin-localization-service.js.map +1 -1
- package/lib/hosted/node/plugin-host.d.ts +1 -1
- package/lib/hosted/node/plugin-host.d.ts.map +1 -1
- package/lib/hosted/node/plugin-host.js +1 -2
- package/lib/hosted/node/plugin-host.js.map +1 -1
- package/lib/main/browser/comments/comment-thread-widget.d.ts +1 -0
- package/lib/main/browser/comments/comment-thread-widget.d.ts.map +1 -1
- package/lib/main/browser/comments/comment-thread-widget.js +11 -0
- package/lib/main/browser/comments/comment-thread-widget.js.map +1 -1
- package/lib/main/browser/tabs/tabs-main.d.ts +10 -0
- package/lib/main/browser/tabs/tabs-main.d.ts.map +1 -0
- package/lib/main/browser/tabs/tabs-main.js +33 -0
- package/lib/main/browser/tabs/tabs-main.js.map +1 -0
- package/lib/main/browser/terminal-main.d.ts +6 -3
- package/lib/main/browser/terminal-main.d.ts.map +1 -1
- package/lib/main/browser/terminal-main.js +22 -2
- package/lib/main/browser/terminal-main.js.map +1 -1
- package/lib/main/browser/view/tree-view-decorator-service.d.ts +2 -4
- package/lib/main/browser/view/tree-view-decorator-service.d.ts.map +1 -1
- package/lib/main/browser/view/tree-view-decorator-service.js +1 -2
- package/lib/main/browser/view/tree-view-decorator-service.js.map +1 -1
- package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts +1 -1
- package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts.map +1 -1
- package/lib/plugin/comments.js +2 -0
- package/lib/plugin/comments.js.map +1 -1
- package/lib/plugin/languages/code-action.d.ts.map +1 -1
- package/lib/plugin/languages/code-action.js +8 -8
- package/lib/plugin/languages/code-action.js.map +1 -1
- package/lib/plugin/plugin-context.d.ts.map +1 -1
- package/lib/plugin/plugin-context.js +15 -1
- package/lib/plugin/plugin-context.js.map +1 -1
- package/lib/plugin/preference-registry.d.ts.map +1 -1
- package/lib/plugin/preference-registry.js +4 -2
- package/lib/plugin/preference-registry.js.map +1 -1
- package/lib/plugin/tabs.d.ts +23 -0
- package/lib/plugin/tabs.d.ts.map +1 -0
- package/lib/plugin/tabs.js +362 -0
- package/lib/plugin/tabs.js.map +1 -0
- package/lib/plugin/terminal-ext.d.ts.map +1 -1
- package/lib/plugin/terminal-ext.js +13 -1
- package/lib/plugin/terminal-ext.js.map +1 -1
- package/lib/plugin/type-converters.d.ts +4 -0
- package/lib/plugin/type-converters.d.ts.map +1 -1
- package/lib/plugin/type-converters.js +53 -43
- package/lib/plugin/type-converters.js.map +1 -1
- package/lib/plugin/types-impl.d.ts +50 -1
- package/lib/plugin/types-impl.d.ts.map +1 -1
- package/lib/plugin/types-impl.js +80 -10
- package/lib/plugin/types-impl.js.map +1 -1
- package/package.json +25 -25
- package/src/common/collections.ts +37 -0
- package/src/common/plugin-api-rpc-model.ts +2 -0
- package/src/common/plugin-api-rpc.ts +134 -10
- package/src/common/rpc-protocol.ts +2 -3
- package/src/common/types.ts +15 -4
- package/src/hosted/node/hosted-plugin-localization-service.ts +3 -3
- package/src/hosted/node/plugin-host.ts +1 -2
- package/src/main/browser/comments/comment-thread-widget.tsx +11 -0
- package/src/main/browser/style/comments.css +6 -0
- package/src/main/browser/tabs/tabs-main.ts +42 -0
- package/src/main/browser/terminal-main.ts +23 -4
- package/src/main/browser/view/tree-view-decorator-service.ts +4 -5
- package/src/plugin/comments.ts +2 -0
- package/src/plugin/languages/code-action.ts +8 -8
- package/src/plugin/plugin-context.ts +28 -5
- package/src/plugin/preference-registry.ts +4 -2
- package/src/plugin/tabs.ts +430 -0
- package/src/plugin/terminal-ext.ts +16 -1
- package/src/plugin/type-converters.ts +58 -46
- package/src/plugin/types-impl.ts +53 -8
|
@@ -110,7 +110,7 @@ import type {
|
|
|
110
110
|
import { SerializableEnvironmentVariableCollection } from '@theia/terminal/lib/common/base-terminal-protocol';
|
|
111
111
|
import { ThemeType } from '@theia/core/lib/common/theme';
|
|
112
112
|
import { Disposable } from '@theia/core/lib/common/disposable';
|
|
113
|
-
import { PickOptions, QuickInputButtonHandle } from '@theia/core/lib/common';
|
|
113
|
+
import { isObject, PickOptions, QuickInputButtonHandle } from '@theia/core/lib/common';
|
|
114
114
|
import { Severity } from '@theia/core/lib/common/severity';
|
|
115
115
|
import { DebugConfiguration, DebugSessionOptions } from '@theia/debug/lib/common/debug-configuration';
|
|
116
116
|
|
|
@@ -303,7 +303,7 @@ export interface TerminalServiceMain {
|
|
|
303
303
|
* Create new Terminal with Terminal options.
|
|
304
304
|
* @param options - object with parameters to create new terminal.
|
|
305
305
|
*/
|
|
306
|
-
$createTerminal(id: string, options: theia.TerminalOptions, isPseudoTerminal?: boolean): Promise<string>;
|
|
306
|
+
$createTerminal(id: string, options: theia.TerminalOptions, parentId?: string, isPseudoTerminal?: boolean): Promise<string>;
|
|
307
307
|
|
|
308
308
|
/**
|
|
309
309
|
* Send text to the terminal by id.
|
|
@@ -780,7 +780,7 @@ export interface TreeViewSelection {
|
|
|
780
780
|
}
|
|
781
781
|
export namespace TreeViewSelection {
|
|
782
782
|
export function is(arg: unknown): arg is TreeViewSelection {
|
|
783
|
-
return
|
|
783
|
+
return isObject(arg) && 'treeViewId' in arg && 'treeItemId' in arg;
|
|
784
784
|
}
|
|
785
785
|
}
|
|
786
786
|
|
|
@@ -826,7 +826,7 @@ export interface ScmCommandArg {
|
|
|
826
826
|
}
|
|
827
827
|
export namespace ScmCommandArg {
|
|
828
828
|
export function is(arg: unknown): arg is ScmCommandArg {
|
|
829
|
-
return
|
|
829
|
+
return isObject(arg) && 'sourceControlHandle' in arg;
|
|
830
830
|
}
|
|
831
831
|
}
|
|
832
832
|
|
|
@@ -842,7 +842,7 @@ export interface ScmExt {
|
|
|
842
842
|
|
|
843
843
|
export namespace TimelineCommandArg {
|
|
844
844
|
export function is(arg: unknown): arg is TimelineCommandArg {
|
|
845
|
-
return
|
|
845
|
+
return isObject(arg) && 'timelineHandle' in arg;
|
|
846
846
|
}
|
|
847
847
|
}
|
|
848
848
|
export interface TimelineCommandArg {
|
|
@@ -861,7 +861,7 @@ export interface DecorationReply { [id: number]: DecorationData; }
|
|
|
861
861
|
|
|
862
862
|
export namespace CommentsCommandArg {
|
|
863
863
|
export function is(arg: unknown): arg is CommentsCommandArg {
|
|
864
|
-
return
|
|
864
|
+
return isObject(arg) && 'commentControlHandle' in arg && 'commentThreadHandle' in arg && 'text' in arg && !('commentUniqueId' in arg);
|
|
865
865
|
}
|
|
866
866
|
}
|
|
867
867
|
export interface CommentsCommandArg {
|
|
@@ -872,7 +872,7 @@ export interface CommentsCommandArg {
|
|
|
872
872
|
|
|
873
873
|
export namespace CommentsContextCommandArg {
|
|
874
874
|
export function is(arg: unknown): arg is CommentsContextCommandArg {
|
|
875
|
-
return
|
|
875
|
+
return isObject(arg) && 'commentControlHandle' in arg && 'commentThreadHandle' in arg && 'commentUniqueId' in arg && !('text' in arg);
|
|
876
876
|
}
|
|
877
877
|
}
|
|
878
878
|
export interface CommentsContextCommandArg {
|
|
@@ -883,7 +883,7 @@ export interface CommentsContextCommandArg {
|
|
|
883
883
|
|
|
884
884
|
export namespace CommentsEditCommandArg {
|
|
885
885
|
export function is(arg: unknown): arg is CommentsEditCommandArg {
|
|
886
|
-
return
|
|
886
|
+
return isObject(arg) && 'commentControlHandle' in arg && 'commentThreadHandle' in arg && 'commentUniqueId' in arg && 'text' in arg;
|
|
887
887
|
}
|
|
888
888
|
}
|
|
889
889
|
export interface CommentsEditCommandArg {
|
|
@@ -1919,6 +1919,128 @@ export interface CommentsMain {
|
|
|
1919
1919
|
$onDidCommentThreadsChange(handle: number, event: CommentThreadChangedEvent): void;
|
|
1920
1920
|
}
|
|
1921
1921
|
|
|
1922
|
+
// #region
|
|
1923
|
+
|
|
1924
|
+
export const enum TabInputKind {
|
|
1925
|
+
UnknownInput,
|
|
1926
|
+
TextInput,
|
|
1927
|
+
TextDiffInput,
|
|
1928
|
+
TextMergeInput,
|
|
1929
|
+
NotebookInput,
|
|
1930
|
+
NotebookDiffInput,
|
|
1931
|
+
CustomEditorInput,
|
|
1932
|
+
WebviewEditorInput,
|
|
1933
|
+
TerminalEditorInput,
|
|
1934
|
+
InteractiveEditorInput,
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1937
|
+
export interface UnknownInputDto {
|
|
1938
|
+
kind: TabInputKind.UnknownInput;
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1941
|
+
export interface TextInputDto {
|
|
1942
|
+
kind: TabInputKind.TextInput;
|
|
1943
|
+
uri: UriComponents;
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
export interface TextDiffInputDto {
|
|
1947
|
+
kind: TabInputKind.TextDiffInput;
|
|
1948
|
+
original: UriComponents;
|
|
1949
|
+
modified: UriComponents;
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
export interface TextMergeInputDto {
|
|
1953
|
+
kind: TabInputKind.TextMergeInput;
|
|
1954
|
+
base: UriComponents;
|
|
1955
|
+
input1: UriComponents;
|
|
1956
|
+
input2: UriComponents;
|
|
1957
|
+
result: UriComponents;
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
export interface NotebookInputDto {
|
|
1961
|
+
kind: TabInputKind.NotebookInput;
|
|
1962
|
+
notebookType: string;
|
|
1963
|
+
uri: UriComponents;
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
export interface NotebookDiffInputDto {
|
|
1967
|
+
kind: TabInputKind.NotebookDiffInput;
|
|
1968
|
+
notebookType: string;
|
|
1969
|
+
original: UriComponents;
|
|
1970
|
+
modified: UriComponents;
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
export interface CustomInputDto {
|
|
1974
|
+
kind: TabInputKind.CustomEditorInput;
|
|
1975
|
+
viewType: string;
|
|
1976
|
+
uri: UriComponents;
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
export interface WebviewInputDto {
|
|
1980
|
+
kind: TabInputKind.WebviewEditorInput;
|
|
1981
|
+
viewType: string;
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
export interface InteractiveEditorInputDto {
|
|
1985
|
+
kind: TabInputKind.InteractiveEditorInput;
|
|
1986
|
+
uri: UriComponents;
|
|
1987
|
+
inputBoxUri: UriComponents;
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
export interface TabInputDto {
|
|
1991
|
+
kind: TabInputKind.TerminalEditorInput;
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
export type EditorGroupColumn = number;
|
|
1995
|
+
export type AnyInputDto = UnknownInputDto | TextInputDto | TextDiffInputDto | TextMergeInputDto | NotebookInputDto | NotebookDiffInputDto | CustomInputDto | WebviewInputDto | InteractiveEditorInputDto | TabInputDto;
|
|
1996
|
+
|
|
1997
|
+
export interface TabGroupDto {
|
|
1998
|
+
isActive: boolean;
|
|
1999
|
+
viewColumn: EditorGroupColumn;
|
|
2000
|
+
tabs: TabDto[];
|
|
2001
|
+
groupId: number;
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
export const enum TabModelOperationKind {
|
|
2005
|
+
TAB_OPEN,
|
|
2006
|
+
TAB_CLOSE,
|
|
2007
|
+
TAB_UPDATE,
|
|
2008
|
+
TAB_MOVE
|
|
2009
|
+
}
|
|
2010
|
+
|
|
2011
|
+
export interface TabOperation {
|
|
2012
|
+
readonly kind: TabModelOperationKind.TAB_OPEN | TabModelOperationKind.TAB_CLOSE | TabModelOperationKind.TAB_UPDATE | TabModelOperationKind.TAB_MOVE;
|
|
2013
|
+
readonly index: number;
|
|
2014
|
+
readonly tabDto: TabDto;
|
|
2015
|
+
readonly groupId: number;
|
|
2016
|
+
readonly oldIndex?: number;
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
export interface TabDto {
|
|
2020
|
+
id: string;
|
|
2021
|
+
label: string;
|
|
2022
|
+
input: any;
|
|
2023
|
+
editorId?: string;
|
|
2024
|
+
isActive: boolean;
|
|
2025
|
+
isPinned: boolean;
|
|
2026
|
+
isPreview: boolean;
|
|
2027
|
+
isDirty: boolean;
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
export interface TabsExt {
|
|
2031
|
+
$acceptEditorTabModel(tabGroups: TabGroupDto[]): void;
|
|
2032
|
+
$acceptTabGroupUpdate(groupDto: TabGroupDto): void;
|
|
2033
|
+
$acceptTabOperation(operation: TabOperation): void;
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
export interface TabsMain {
|
|
2037
|
+
$moveTab(tabId: string, index: number, viewColumn: EditorGroupColumn, preserveFocus?: boolean): void;
|
|
2038
|
+
$closeTab(tabIds: string[], preserveFocus?: boolean): Promise<boolean>;
|
|
2039
|
+
$closeGroup(groupIds: number[], preservceFocus?: boolean): Promise<boolean>;
|
|
2040
|
+
}
|
|
2041
|
+
|
|
2042
|
+
// endregion
|
|
2043
|
+
|
|
1922
2044
|
export const PLUGIN_RPC_CONTEXT = {
|
|
1923
2045
|
AUTHENTICATION_MAIN: <ProxyIdentifier<AuthenticationMain>>createProxyIdentifier<AuthenticationMain>('AuthenticationMain'),
|
|
1924
2046
|
COMMAND_REGISTRY_MAIN: <ProxyIdentifier<CommandRegistryMain>>createProxyIdentifier<CommandRegistryMain>('CommandRegistryMain'),
|
|
@@ -1952,7 +2074,8 @@ export const PLUGIN_RPC_CONTEXT = {
|
|
|
1952
2074
|
LABEL_SERVICE_MAIN: <ProxyIdentifier<LabelServiceMain>>createProxyIdentifier<LabelServiceMain>('LabelServiceMain'),
|
|
1953
2075
|
TIMELINE_MAIN: <ProxyIdentifier<TimelineMain>>createProxyIdentifier<TimelineMain>('TimelineMain'),
|
|
1954
2076
|
THEMING_MAIN: <ProxyIdentifier<ThemingMain>>createProxyIdentifier<ThemingMain>('ThemingMain'),
|
|
1955
|
-
COMMENTS_MAIN: <ProxyIdentifier<CommentsMain>>createProxyIdentifier<CommentsMain>('CommentsMain')
|
|
2077
|
+
COMMENTS_MAIN: <ProxyIdentifier<CommentsMain>>createProxyIdentifier<CommentsMain>('CommentsMain'),
|
|
2078
|
+
TABS_MAIN: <ProxyIdentifier<TabsMain>>createProxyIdentifier<TabsMain>('TabsMain')
|
|
1956
2079
|
};
|
|
1957
2080
|
|
|
1958
2081
|
export const MAIN_RPC_CONTEXT = {
|
|
@@ -1986,7 +2109,8 @@ export const MAIN_RPC_CONTEXT = {
|
|
|
1986
2109
|
LABEL_SERVICE_EXT: createProxyIdentifier<LabelServiceExt>('LabelServiceExt'),
|
|
1987
2110
|
TIMELINE_EXT: createProxyIdentifier<TimelineExt>('TimeLineExt'),
|
|
1988
2111
|
THEMING_EXT: createProxyIdentifier<ThemingExt>('ThemingExt'),
|
|
1989
|
-
COMMENTS_EXT: createProxyIdentifier<CommentsExt>('CommentsExt')
|
|
2112
|
+
COMMENTS_EXT: createProxyIdentifier<CommentsExt>('CommentsExt'),
|
|
2113
|
+
TABS_EXT: createProxyIdentifier<TabsExt>('TabsExt')
|
|
1990
2114
|
};
|
|
1991
2115
|
|
|
1992
2116
|
export interface TasksExt {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
24
24
|
|
|
25
|
-
import { Channel, Disposable, DisposableCollection, ReadBuffer, WriteBuffer } from '@theia/core';
|
|
25
|
+
import { Channel, Disposable, DisposableCollection, isObject, ReadBuffer, URI, WriteBuffer } from '@theia/core';
|
|
26
26
|
import { Emitter, Event } from '@theia/core/lib/common/event';
|
|
27
27
|
import { ChannelMultiplexer, MessageProvider } from '@theia/core/lib/common/message-rpc/channel';
|
|
28
28
|
import { MsgPackMessageDecoder, MsgPackMessageEncoder } from '@theia/core/lib/common/message-rpc/rpc-message-encoder';
|
|
@@ -30,7 +30,6 @@ import { Uint8ArrayReadBuffer, Uint8ArrayWriteBuffer } from '@theia/core/lib/com
|
|
|
30
30
|
import { ClientProxyHandler, RpcInvocationHandler } from './proxy-handler';
|
|
31
31
|
import { MsgPackExtensionManager } from '@theia/core/lib/common/message-rpc/msg-pack-extension-manager';
|
|
32
32
|
import { URI as VSCodeURI } from '@theia/core/shared/vscode-uri';
|
|
33
|
-
import URI from '@theia/core/lib/common/uri';
|
|
34
33
|
import { BinaryBuffer } from '@theia/core/lib/common/buffer';
|
|
35
34
|
import { Range, Position } from '../plugin/types-impl';
|
|
36
35
|
|
|
@@ -74,7 +73,7 @@ export namespace ConnectionClosedError {
|
|
|
74
73
|
return Object.assign(new Error(message), { code });
|
|
75
74
|
}
|
|
76
75
|
export function is(error: unknown): error is ConnectionClosedError {
|
|
77
|
-
return
|
|
76
|
+
return isObject(error) && 'code' in error && (error as ConnectionClosedError).code === code;
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
79
|
|
package/src/common/types.ts
CHANGED
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
20
20
|
*--------------------------------------------------------------------------------------------*/
|
|
21
21
|
|
|
22
|
+
import { isObject as isObject0 } from '@theia/core/lib/common';
|
|
23
|
+
|
|
22
24
|
/**
|
|
23
25
|
* Returns `true` if the parameter has type "object" and not null, an array, a regexp, a date.
|
|
24
26
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return typeof obj === 'object'
|
|
28
|
-
&& obj !== null // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
27
|
+
export function isObject(obj: unknown): boolean {
|
|
28
|
+
return isObject0(obj)
|
|
29
29
|
&& !Array.isArray(obj)
|
|
30
30
|
&& !(obj instanceof RegExp)
|
|
31
31
|
&& !(obj instanceof Date);
|
|
@@ -116,3 +116,14 @@ export function isUndefined(obj: any): obj is undefined {
|
|
|
116
116
|
export function isUndefinedOrNull(obj: any): obj is undefined | null {
|
|
117
117
|
return isUndefined(obj) || obj === null; // eslint-disable-line no-null/no-null
|
|
118
118
|
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Asserts that the argument passed in is neither undefined nor null.
|
|
122
|
+
*/
|
|
123
|
+
export function assertIsDefined<T>(arg: T | null | undefined): T {
|
|
124
|
+
if (isUndefinedOrNull(arg)) {
|
|
125
|
+
throw new Error('Assertion Failed: argument is undefined or null');
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return arg;
|
|
129
|
+
}
|
|
@@ -23,7 +23,7 @@ import { DeployedPlugin, Localization as PluginLocalization, PluginIdentifiers }
|
|
|
23
23
|
import { URI } from '@theia/core/shared/vscode-uri';
|
|
24
24
|
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
|
|
25
25
|
import { BackendApplicationContribution } from '@theia/core/lib/node';
|
|
26
|
-
import { Disposable, MaybePromise } from '@theia/core';
|
|
26
|
+
import { Disposable, isObject, MaybePromise } from '@theia/core';
|
|
27
27
|
import { Deferred } from '@theia/core/lib/common/promise-util';
|
|
28
28
|
|
|
29
29
|
export interface VSCodeNlsConfig {
|
|
@@ -205,7 +205,7 @@ interface LocalizeInfo {
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
function isLocalizeInfo(obj: unknown): obj is LocalizeInfo {
|
|
208
|
-
return
|
|
208
|
+
return isObject(obj) && 'message' in obj || false;
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
function coerceLocalizations(translations: Record<string, string | LocalizeInfo>): Record<string, string> {
|
|
@@ -243,7 +243,7 @@ function localizePackage(value: unknown, translations: PackageTranslation, callb
|
|
|
243
243
|
}
|
|
244
244
|
return result;
|
|
245
245
|
}
|
|
246
|
-
if (
|
|
246
|
+
if (isObject(value)) {
|
|
247
247
|
const result: Record<string, unknown> = {};
|
|
248
248
|
for (const [name, item] of Object.entries(value)) {
|
|
249
249
|
result[name] = localizePackage(item, translations, callback);
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
//
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import 'reflect-metadata';
|
|
16
|
+
import '@theia/core/shared/reflect-metadata';
|
|
18
17
|
import { ConnectionClosedError, RPCProtocolImpl } from '../../common/rpc-protocol';
|
|
19
18
|
import { ProcessTerminatedMessage, ProcessTerminateMessage } from './hosted-plugin-protocol';
|
|
20
19
|
import { PluginHostRPC } from './plugin-host-rpc';
|
|
@@ -479,6 +479,7 @@ export class ReviewComment<P extends ReviewComment.Props = ReviewComment.Props>
|
|
|
479
479
|
<div className={'review-comment-contents'}>
|
|
480
480
|
<div className={'comment-title monaco-mouse-cursor-text'}>
|
|
481
481
|
<strong className={'author'}>{comment.userName}</strong>
|
|
482
|
+
<small className={'timestamp'}>{this.localeDate(comment.timestamp)}</small>
|
|
482
483
|
<span className={'isPending'}>{comment.label}</span>
|
|
483
484
|
<div className={'theia-comments-inline-actions-container'}>
|
|
484
485
|
<div className={'theia-comments-inline-actions'} role={'toolbar'}>
|
|
@@ -498,6 +499,16 @@ export class ReviewComment<P extends ReviewComment.Props = ReviewComment.Props>
|
|
|
498
499
|
</div>
|
|
499
500
|
</div>;
|
|
500
501
|
}
|
|
502
|
+
protected localeDate(timestamp: string | undefined): string {
|
|
503
|
+
if (timestamp === undefined) {
|
|
504
|
+
return '';
|
|
505
|
+
}
|
|
506
|
+
const date = new Date(timestamp);
|
|
507
|
+
if (!isNaN(date.getTime())) {
|
|
508
|
+
return date.toLocaleString();
|
|
509
|
+
}
|
|
510
|
+
return '';
|
|
511
|
+
}
|
|
501
512
|
}
|
|
502
513
|
|
|
503
514
|
namespace CommentBody {
|
|
@@ -149,6 +149,12 @@
|
|
|
149
149
|
line-height: var(--theia-content-line-height);
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
.monaco-editor .review-widget .body .review-comment .review-comment-contents .timestamp {
|
|
153
|
+
line-height: var(--theia-content-line-height);
|
|
154
|
+
margin: 0 5px 0 5px;
|
|
155
|
+
padding: 0 2px 0 2px;
|
|
156
|
+
}
|
|
157
|
+
|
|
152
158
|
.monaco-editor .review-widget .body .review-comment .review-comment-contents .isPending {
|
|
153
159
|
margin: 0 5px 0 5px;
|
|
154
160
|
padding: 0 2px 0 2px;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2022 TypeFox and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { interfaces } from '@theia/core/shared/inversify';
|
|
18
|
+
|
|
19
|
+
import { TabsMain } from '../../../common/plugin-api-rpc';
|
|
20
|
+
import { RPCProtocol } from '../../../common/rpc-protocol';
|
|
21
|
+
|
|
22
|
+
export class TabsMainImp implements TabsMain {
|
|
23
|
+
|
|
24
|
+
constructor(
|
|
25
|
+
rpc: RPCProtocol,
|
|
26
|
+
container: interfaces.Container
|
|
27
|
+
) {}
|
|
28
|
+
|
|
29
|
+
// #region Messages received from Ext Host
|
|
30
|
+
$moveTab(tabId: string, index: number, viewColumn: number, preserveFocus?: boolean): void {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async $closeTab(tabIds: string[], preserveFocus?: boolean): Promise<boolean> {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async $closeGroup(groupIds: number[], preserveFocus?: boolean): Promise<boolean> {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
// #endregion
|
|
42
|
+
}
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
|
|
17
17
|
import { interfaces } from '@theia/core/shared/inversify';
|
|
18
18
|
import { ApplicationShell, WidgetOpenerOptions } from '@theia/core/lib/browser';
|
|
19
|
-
import { TerminalOptions } from '@theia/plugin';
|
|
20
19
|
import { CancellationToken } from '@theia/core/shared/vscode-languageserver-protocol';
|
|
21
|
-
import {
|
|
20
|
+
import { TerminalEditorLocationOptions, TerminalOptions } from '@theia/plugin';
|
|
21
|
+
import { TerminalLocation, TerminalWidget } from '@theia/terminal/lib/browser/base/terminal-widget';
|
|
22
22
|
import { TerminalService } from '@theia/terminal/lib/browser/base/terminal-service';
|
|
23
23
|
import { TerminalServiceMain, TerminalServiceExt, MAIN_RPC_CONTEXT } from '../../common/plugin-api-rpc';
|
|
24
24
|
import { RPCProtocol } from '../../common/rpc-protocol';
|
|
@@ -122,7 +122,7 @@ export class TerminalServiceMainImpl implements TerminalServiceMain, TerminalLin
|
|
|
122
122
|
terminal.resize(cols, rows);
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
async $createTerminal(id: string, options: TerminalOptions, isPseudoTerminal?: boolean): Promise<string> {
|
|
125
|
+
async $createTerminal(id: string, options: TerminalOptions, parentId?: string, isPseudoTerminal?: boolean): Promise<string> {
|
|
126
126
|
try {
|
|
127
127
|
const terminal = await this.terminals.newTerminal({
|
|
128
128
|
id,
|
|
@@ -136,7 +136,9 @@ export class TerminalServiceMainImpl implements TerminalServiceMain, TerminalLin
|
|
|
136
136
|
useServerTitle: false,
|
|
137
137
|
attributes: options.attributes,
|
|
138
138
|
hideFromUser: options.hideFromUser,
|
|
139
|
-
|
|
139
|
+
location: this.getTerminalLocation(options, parentId),
|
|
140
|
+
isPseudoTerminal,
|
|
141
|
+
isTransient: options.isTransient
|
|
140
142
|
});
|
|
141
143
|
if (options.message) {
|
|
142
144
|
terminal.writeLine(options.message);
|
|
@@ -148,6 +150,23 @@ export class TerminalServiceMainImpl implements TerminalServiceMain, TerminalLin
|
|
|
148
150
|
}
|
|
149
151
|
}
|
|
150
152
|
|
|
153
|
+
protected getTerminalLocation(options: TerminalOptions, parentId?: string): TerminalLocation | TerminalEditorLocationOptions | { parentTerminal: string; } | undefined {
|
|
154
|
+
if (typeof options.location === 'number' && Object.values(TerminalLocation).includes(options.location)) {
|
|
155
|
+
return options.location;
|
|
156
|
+
} else if (options.location && typeof options.location === 'object') {
|
|
157
|
+
if ('parentTerminal' in options.location) {
|
|
158
|
+
if (!parentId) {
|
|
159
|
+
throw new Error('parentTerminal is set but no parentId is provided');
|
|
160
|
+
}
|
|
161
|
+
return { 'parentTerminal': parentId };
|
|
162
|
+
} else {
|
|
163
|
+
return options.location;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return undefined;
|
|
168
|
+
}
|
|
169
|
+
|
|
151
170
|
$sendText(id: string, text: string, addNewLine?: boolean): void {
|
|
152
171
|
const terminal = this.terminals.getById(id);
|
|
153
172
|
if (terminal) {
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
|
|
17
17
|
import { inject, injectable, interfaces, named } from '@theia/core/shared/inversify';
|
|
18
18
|
import { AbstractTreeDecoratorService, TreeDecorator } from '@theia/core/lib/browser/tree/tree-decorator';
|
|
19
|
-
import { bindContributionProvider, ContributionProvider } from '@theia/core';
|
|
19
|
+
import { bindContributionProvider, ContributionProvider, isObject } from '@theia/core';
|
|
20
20
|
import { TreeNode } from '@theia/core/lib/browser';
|
|
21
|
-
import { TreeItem
|
|
21
|
+
import { TreeItem } from '@theia/plugin';
|
|
22
22
|
import URI from '@theia/core/lib/common/uri';
|
|
23
23
|
import { FileTreeDecoratorAdapter } from '@theia/filesystem/lib/browser';
|
|
24
24
|
|
|
@@ -32,9 +32,8 @@ export class TreeViewDecoratorAdapter extends FileTreeDecoratorAdapter {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
protected isTreeItem(node: unknown): node is TreeItem
|
|
36
|
-
|
|
37
|
-
return !!candidate && typeof node === 'object' && 'resourceUri' in candidate && !!candidate.resourceUri;
|
|
35
|
+
protected isTreeItem(node: unknown): node is TreeItem {
|
|
36
|
+
return isObject<TreeItem>(node) && !!node.resourceUri;
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
|
package/src/plugin/comments.ts
CHANGED
|
@@ -491,6 +491,7 @@ function convertToModeComment(thread: ExtHostCommentThread, commentController: C
|
|
|
491
491
|
}
|
|
492
492
|
|
|
493
493
|
const iconPath = theiaComment.author && theiaComment.author.iconPath ? theiaComment.author.iconPath.toString() : undefined;
|
|
494
|
+
const date = theiaComment.timestamp ? theiaComment.timestamp.toISOString() : undefined;
|
|
494
495
|
|
|
495
496
|
return {
|
|
496
497
|
mode: theiaComment.mode,
|
|
@@ -500,6 +501,7 @@ function convertToModeComment(thread: ExtHostCommentThread, commentController: C
|
|
|
500
501
|
userName: theiaComment.author.name,
|
|
501
502
|
userIconPath: iconPath,
|
|
502
503
|
label: theiaComment.label,
|
|
504
|
+
timestamp: date,
|
|
503
505
|
};
|
|
504
506
|
}
|
|
505
507
|
|
|
@@ -24,6 +24,7 @@ import { Diagnostics } from './diagnostics';
|
|
|
24
24
|
import { CodeActionKind } from '../types-impl';
|
|
25
25
|
import { CommandRegistryImpl } from '../command-registry';
|
|
26
26
|
import { DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
27
|
+
import { isObject } from '@theia/core/lib/common';
|
|
27
28
|
|
|
28
29
|
export class CodeActionAdapter {
|
|
29
30
|
|
|
@@ -147,16 +148,15 @@ export class CodeActionAdapter {
|
|
|
147
148
|
}
|
|
148
149
|
|
|
149
150
|
private static _isCommand(arg: unknown): arg is theia.Command {
|
|
150
|
-
return
|
|
151
|
+
return isObject<theia.Command>(arg) && typeof arg.command === 'string';
|
|
151
152
|
}
|
|
152
153
|
|
|
153
|
-
private static _isSelection(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
&& typeof
|
|
157
|
-
&& typeof
|
|
158
|
-
&& typeof
|
|
159
|
-
&& typeof selection.positionColumn === 'number';
|
|
154
|
+
private static _isSelection(arg: unknown): arg is Selection {
|
|
155
|
+
return isObject<Selection>(arg)
|
|
156
|
+
&& typeof arg.selectionStartLineNumber === 'number'
|
|
157
|
+
&& typeof arg.selectionStartColumn === 'number'
|
|
158
|
+
&& typeof arg.positionLineNumber === 'number'
|
|
159
|
+
&& typeof arg.positionColumn === 'number';
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
}
|
|
@@ -152,6 +152,7 @@ import {
|
|
|
152
152
|
TextDocumentChangeReason,
|
|
153
153
|
InputBoxValidationSeverity,
|
|
154
154
|
TerminalLink,
|
|
155
|
+
TerminalLocation,
|
|
155
156
|
InlayHint,
|
|
156
157
|
InlayHintKind,
|
|
157
158
|
InlayHintLabelPart,
|
|
@@ -175,7 +176,15 @@ import {
|
|
|
175
176
|
ExtensionKind,
|
|
176
177
|
InlineCompletionItem,
|
|
177
178
|
InlineCompletionList,
|
|
178
|
-
InlineCompletionTriggerKind
|
|
179
|
+
InlineCompletionTriggerKind,
|
|
180
|
+
TextTabInput,
|
|
181
|
+
CustomEditorTabInput,
|
|
182
|
+
NotebookDiffEditorTabInput,
|
|
183
|
+
NotebookEditorTabInput,
|
|
184
|
+
TerminalEditorTabInput,
|
|
185
|
+
TextDiffTabInput,
|
|
186
|
+
TextMergeTabInput,
|
|
187
|
+
WebviewEditorTabInput
|
|
179
188
|
} from './types-impl';
|
|
180
189
|
import { AuthenticationExtImpl } from './authentication-ext';
|
|
181
190
|
import { SymbolKind } from '../common/plugin-api-rpc-model';
|
|
@@ -218,6 +227,7 @@ import { WebviewViewsExtImpl } from './webview-views';
|
|
|
218
227
|
import { PluginPackage } from '../common';
|
|
219
228
|
import { Endpoint } from '@theia/core/lib/browser/endpoint';
|
|
220
229
|
import { FilePermission } from '@theia/filesystem/lib/common/files';
|
|
230
|
+
import { TabsExtImpl } from './tabs';
|
|
221
231
|
|
|
222
232
|
export function createAPIFactory(
|
|
223
233
|
rpc: RPCProtocol,
|
|
@@ -255,6 +265,7 @@ export function createAPIFactory(
|
|
|
255
265
|
const timelineExt = rpc.set(MAIN_RPC_CONTEXT.TIMELINE_EXT, new TimelineExtImpl(rpc, commandRegistry));
|
|
256
266
|
const themingExt = rpc.set(MAIN_RPC_CONTEXT.THEMING_EXT, new ThemingExtImpl(rpc));
|
|
257
267
|
const commentsExt = rpc.set(MAIN_RPC_CONTEXT.COMMENTS_EXT, new CommentsExtImpl(rpc, commandRegistry, documents));
|
|
268
|
+
const tabsExt = rpc.set(MAIN_RPC_CONTEXT.TABS_EXT, new TabsExtImpl(rpc));
|
|
258
269
|
const customEditorExt = rpc.set(MAIN_RPC_CONTEXT.CUSTOM_EDITORS_EXT, new CustomEditorsExtImpl(rpc, documents, webviewExt, workspaceExt));
|
|
259
270
|
const webviewViewsExt = rpc.set(MAIN_RPC_CONTEXT.WEBVIEW_VIEWS_EXT, new WebviewViewsExtImpl(rpc, webviewExt));
|
|
260
271
|
rpc.set(MAIN_RPC_CONTEXT.DEBUG_EXT, debugExt);
|
|
@@ -496,7 +507,7 @@ export function createAPIFactory(
|
|
|
496
507
|
onDidChangeWindowState(listener, thisArg?, disposables?): theia.Disposable {
|
|
497
508
|
return windowStateExt.onDidChangeWindowState(listener, thisArg, disposables);
|
|
498
509
|
},
|
|
499
|
-
createTerminal(nameOrOptions: theia.TerminalOptions | theia.
|
|
510
|
+
createTerminal(nameOrOptions: theia.TerminalOptions | theia.ExtensionTerminalOptions | theia.ExtensionTerminalOptions | (string | undefined),
|
|
500
511
|
shellPath?: string,
|
|
501
512
|
shellArgs?: string[] | string): theia.Terminal {
|
|
502
513
|
return terminalExt.createTerminal(nameOrOptions, shellPath, shellArgs);
|
|
@@ -541,6 +552,9 @@ export function createAPIFactory(
|
|
|
541
552
|
},
|
|
542
553
|
onDidChangeActiveColorTheme(listener, thisArg?, disposables?) {
|
|
543
554
|
return themingExt.onDidChangeActiveColorTheme(listener, thisArg, disposables);
|
|
555
|
+
},
|
|
556
|
+
get tabGroups(): theia.TabGroups {
|
|
557
|
+
return tabsExt.tabGroups;
|
|
544
558
|
}
|
|
545
559
|
};
|
|
546
560
|
|
|
@@ -1075,7 +1089,7 @@ export function createAPIFactory(
|
|
|
1075
1089
|
notebook: theia.NotebookDocument,
|
|
1076
1090
|
controller: theia.NotebookController
|
|
1077
1091
|
): (void | Thenable<void>) { },
|
|
1078
|
-
onDidChangeSelectedNotebooks: () => Disposable.create(() => {}),
|
|
1092
|
+
onDidChangeSelectedNotebooks: () => Disposable.create(() => { }),
|
|
1079
1093
|
updateNotebookAffinity: (notebook: theia.NotebookDocument, affinity: theia.NotebookControllerAffinity) => undefined,
|
|
1080
1094
|
dispose: () => undefined,
|
|
1081
1095
|
};
|
|
@@ -1086,7 +1100,7 @@ export function createAPIFactory(
|
|
|
1086
1100
|
) {
|
|
1087
1101
|
return {
|
|
1088
1102
|
rendererId,
|
|
1089
|
-
onDidReceiveMessage: () => Disposable.create(() => {}
|
|
1103
|
+
onDidReceiveMessage: () => Disposable.create(() => { }),
|
|
1090
1104
|
postMessage: () => Promise.resolve({}),
|
|
1091
1105
|
};
|
|
1092
1106
|
},
|
|
@@ -1262,7 +1276,16 @@ export function createAPIFactory(
|
|
|
1262
1276
|
ExtensionKind,
|
|
1263
1277
|
InlineCompletionItem,
|
|
1264
1278
|
InlineCompletionList,
|
|
1265
|
-
InlineCompletionTriggerKind
|
|
1279
|
+
InlineCompletionTriggerKind,
|
|
1280
|
+
TabInputText: TextTabInput,
|
|
1281
|
+
TabInputTextDiff: TextDiffTabInput,
|
|
1282
|
+
TabInputTextMerge: TextMergeTabInput,
|
|
1283
|
+
TabInputCustom: CustomEditorTabInput,
|
|
1284
|
+
TabInputNotebook: NotebookEditorTabInput,
|
|
1285
|
+
TabInputNotebookDiff: NotebookDiffEditorTabInput,
|
|
1286
|
+
TabInputWebview: WebviewEditorTabInput,
|
|
1287
|
+
TabInputTerminal: TerminalEditorTabInput,
|
|
1288
|
+
TerminalLocation
|
|
1266
1289
|
};
|
|
1267
1290
|
};
|
|
1268
1291
|
}
|
|
@@ -170,7 +170,9 @@ export class PreferenceRegistryExtImpl implements PreferenceRegistryExt {
|
|
|
170
170
|
},
|
|
171
171
|
update: (key: string, value: any, targetScope?: ConfigurationTarget | boolean, withLanguageOverride?: boolean): PromiseLike<void> => {
|
|
172
172
|
const resourceStr = overrides.resource?.toString();
|
|
173
|
-
const
|
|
173
|
+
const overrideSegment = overrides.overrideIdentifier ? `[${overrides.overrideIdentifier}].` : '';
|
|
174
|
+
const preferenceKey = rawSection ? `${rawSection}.${key}` : key;
|
|
175
|
+
const fullPath = overrideSegment + preferenceKey;
|
|
174
176
|
if (typeof value !== 'undefined') {
|
|
175
177
|
return this.proxy.$updateConfigurationOption(targetScope, fullPath, value, resourceStr, withLanguageOverride);
|
|
176
178
|
} else {
|
|
@@ -178,7 +180,7 @@ export class PreferenceRegistryExtImpl implements PreferenceRegistryExt {
|
|
|
178
180
|
}
|
|
179
181
|
},
|
|
180
182
|
inspect: <T>(key: string): ConfigurationInspect<T> | undefined => {
|
|
181
|
-
const path = `${rawSection}.${key}
|
|
183
|
+
const path = rawSection ? `${rawSection}.${key}` : key;
|
|
182
184
|
const result = this._preferences.inspect<T>(path, overrides, new TheiaWorkspace(this.workspace));
|
|
183
185
|
|
|
184
186
|
if (!result) {
|