@theia/plugin-ext 1.33.0 → 1.34.0-next.31
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 +108 -3
- 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/commands.js +1 -1
- package/lib/main/browser/commands.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/dialogs-main.d.ts.map +1 -1
- package/lib/main/browser/dialogs-main.js +2 -1
- package/lib/main/browser/dialogs-main.js.map +1 -1
- package/lib/main/browser/scm-main.d.ts +1 -0
- package/lib/main/browser/scm-main.d.ts.map +1 -1
- package/lib/main/browser/scm-main.js +7 -0
- package/lib/main/browser/scm-main.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 +24 -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 +16 -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/quick-open.d.ts +3 -0
- package/lib/plugin/quick-open.d.ts.map +1 -1
- package/lib/plugin/quick-open.js +7 -0
- package/lib/plugin/quick-open.js.map +1 -1
- package/lib/plugin/scm.d.ts +3 -0
- package/lib/plugin/scm.d.ts.map +1 -1
- package/lib/plugin/scm.js +7 -0
- package/lib/plugin/scm.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 +4 -0
- package/lib/plugin/terminal-ext.d.ts.map +1 -1
- package/lib/plugin/terminal-ext.js +30 -2
- package/lib/plugin/terminal-ext.js.map +1 -1
- package/lib/plugin/type-converters.d.ts +8 -0
- package/lib/plugin/type-converters.d.ts.map +1 -1
- package/lib/plugin/type-converters.js +68 -46
- package/lib/plugin/type-converters.js.map +1 -1
- package/lib/plugin/type-converters.spec.js +19 -0
- package/lib/plugin/type-converters.spec.js.map +1 -1
- package/lib/plugin/types-impl.d.ts +76 -6
- package/lib/plugin/types-impl.d.ts.map +1 -1
- package/lib/plugin/types-impl.js +121 -16
- 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 +137 -13
- 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/commands.ts +1 -1
- package/src/main/browser/comments/comment-thread-widget.tsx +11 -0
- package/src/main/browser/dialogs-main.ts +2 -1
- package/src/main/browser/scm-main.ts +10 -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 +25 -4
- package/src/main/browser/view/tree-view-decorator-service.ts +4 -5
- package/src/main/browser/webview/pre/main.js +112 -111
- package/src/plugin/comments.ts +2 -0
- package/src/plugin/languages/code-action.ts +8 -8
- package/src/plugin/plugin-context.ts +30 -5
- package/src/plugin/preference-registry.ts +4 -2
- package/src/plugin/quick-open.ts +10 -0
- package/src/plugin/scm.ts +11 -0
- package/src/plugin/tabs.ts +430 -0
- package/src/plugin/terminal-ext.ts +34 -3
- package/src/plugin/type-converters.spec.ts +20 -0
- package/src/plugin/type-converters.ts +73 -50
- package/src/plugin/types-impl.ts +126 -21
|
@@ -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 {
|
|
@@ -919,6 +919,7 @@ export interface ScmMain {
|
|
|
919
919
|
$setInputBoxValue(sourceControlHandle: number, value: string): void;
|
|
920
920
|
$setInputBoxPlaceholder(sourceControlHandle: number, placeholder: string): void;
|
|
921
921
|
$setInputBoxVisible(sourceControlHandle: number, visible: boolean): void;
|
|
922
|
+
$setInputBoxEnabled(sourceControlHandle: number, enabled: boolean): void;
|
|
922
923
|
}
|
|
923
924
|
|
|
924
925
|
export interface SourceControlProviderFeatures {
|
|
@@ -1407,7 +1408,7 @@ export interface WorkspaceEditMetadataDto {
|
|
|
1407
1408
|
} | {
|
|
1408
1409
|
light: UriComponents;
|
|
1409
1410
|
dark: UriComponents;
|
|
1410
|
-
};
|
|
1411
|
+
} | ThemeIcon;
|
|
1411
1412
|
}
|
|
1412
1413
|
|
|
1413
1414
|
export interface WorkspaceFileEditDto {
|
|
@@ -1420,9 +1421,8 @@ export interface WorkspaceFileEditDto {
|
|
|
1420
1421
|
export interface WorkspaceTextEditDto {
|
|
1421
1422
|
resource: UriComponents;
|
|
1422
1423
|
modelVersionId?: number;
|
|
1423
|
-
textEdit: TextEdit;
|
|
1424
|
+
textEdit: TextEdit & { insertAsSnippet?: boolean };
|
|
1424
1425
|
metadata?: WorkspaceEditMetadataDto;
|
|
1425
|
-
|
|
1426
1426
|
}
|
|
1427
1427
|
export namespace WorkspaceTextEditDto {
|
|
1428
1428
|
export function is(arg: WorkspaceTextEditDto | WorkspaceFileEditDto): arg is WorkspaceTextEditDto {
|
|
@@ -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[], preserveFocus?: 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';
|
|
@@ -71,7 +71,7 @@ class OpenNewTabDialog extends AbstractDialog<string> {
|
|
|
71
71
|
|
|
72
72
|
constructor(windowService: WindowService) {
|
|
73
73
|
super({
|
|
74
|
-
title: 'Your browser prevented opening of a new tab'
|
|
74
|
+
title: nls.localize('theia/plugin/blockNewTab', 'Your browser prevented opening of a new tab')
|
|
75
75
|
});
|
|
76
76
|
this.windowService = windowService;
|
|
77
77
|
|
|
@@ -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 {
|
|
@@ -24,6 +24,7 @@ import { FileUploadService } from '@theia/filesystem/lib/browser/file-upload-ser
|
|
|
24
24
|
import { FileService } from '@theia/filesystem/lib/browser/file-service';
|
|
25
25
|
import { FileStat } from '@theia/filesystem/lib/common/files';
|
|
26
26
|
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
|
|
27
|
+
import { nls } from '@theia/core';
|
|
27
28
|
|
|
28
29
|
export class DialogsMainImpl implements DialogsMain {
|
|
29
30
|
|
|
@@ -146,7 +147,7 @@ export class DialogsMainImpl implements DialogsMain {
|
|
|
146
147
|
try {
|
|
147
148
|
// Create save file dialog props
|
|
148
149
|
const dialogProps = {
|
|
149
|
-
title: options.title ?? 'Save',
|
|
150
|
+
title: options.title ?? nls.localizeByDefault('Save'),
|
|
150
151
|
saveLabel: options.saveLabel,
|
|
151
152
|
filters: options.filters,
|
|
152
153
|
inputValue: fileNameValue
|
|
@@ -440,4 +440,14 @@ export class ScmMainImpl implements ScmMain {
|
|
|
440
440
|
|
|
441
441
|
repository.input.visible = visible;
|
|
442
442
|
}
|
|
443
|
+
|
|
444
|
+
$setInputBoxEnabled(sourceControlHandle: number, enabled: boolean): void {
|
|
445
|
+
const repository = this.repositories.get(sourceControlHandle);
|
|
446
|
+
|
|
447
|
+
if (!repository) {
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
repository.input.enabled = enabled;
|
|
452
|
+
}
|
|
443
453
|
}
|
|
@@ -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';
|
|
@@ -27,6 +27,7 @@ import { SerializableEnvironmentVariableCollection } from '@theia/terminal/lib/c
|
|
|
27
27
|
import { ShellTerminalServerProxy } from '@theia/terminal/lib/common/shell-terminal-protocol';
|
|
28
28
|
import { TerminalLink, TerminalLinkProvider } from '@theia/terminal/lib/browser/terminal-link-provider';
|
|
29
29
|
import { URI } from '@theia/core/lib/common/uri';
|
|
30
|
+
import { getIconClass } from '../../plugin/terminal-ext';
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* Plugin api service allows working with terminal emulator.
|
|
@@ -122,11 +123,12 @@ export class TerminalServiceMainImpl implements TerminalServiceMain, TerminalLin
|
|
|
122
123
|
terminal.resize(cols, rows);
|
|
123
124
|
}
|
|
124
125
|
|
|
125
|
-
async $createTerminal(id: string, options: TerminalOptions, isPseudoTerminal?: boolean): Promise<string> {
|
|
126
|
+
async $createTerminal(id: string, options: TerminalOptions, parentId?: string, isPseudoTerminal?: boolean): Promise<string> {
|
|
126
127
|
try {
|
|
127
128
|
const terminal = await this.terminals.newTerminal({
|
|
128
129
|
id,
|
|
129
130
|
title: options.name,
|
|
131
|
+
iconClass: getIconClass(options),
|
|
130
132
|
shellPath: options.shellPath,
|
|
131
133
|
shellArgs: options.shellArgs,
|
|
132
134
|
cwd: options.cwd ? new URI(options.cwd) : undefined,
|
|
@@ -136,7 +138,9 @@ export class TerminalServiceMainImpl implements TerminalServiceMain, TerminalLin
|
|
|
136
138
|
useServerTitle: false,
|
|
137
139
|
attributes: options.attributes,
|
|
138
140
|
hideFromUser: options.hideFromUser,
|
|
139
|
-
|
|
141
|
+
location: this.getTerminalLocation(options, parentId),
|
|
142
|
+
isPseudoTerminal,
|
|
143
|
+
isTransient: options.isTransient
|
|
140
144
|
});
|
|
141
145
|
if (options.message) {
|
|
142
146
|
terminal.writeLine(options.message);
|
|
@@ -148,6 +152,23 @@ export class TerminalServiceMainImpl implements TerminalServiceMain, TerminalLin
|
|
|
148
152
|
}
|
|
149
153
|
}
|
|
150
154
|
|
|
155
|
+
protected getTerminalLocation(options: TerminalOptions, parentId?: string): TerminalLocation | TerminalEditorLocationOptions | { parentTerminal: string; } | undefined {
|
|
156
|
+
if (typeof options.location === 'number' && Object.values(TerminalLocation).includes(options.location)) {
|
|
157
|
+
return options.location;
|
|
158
|
+
} else if (options.location && typeof options.location === 'object') {
|
|
159
|
+
if ('parentTerminal' in options.location) {
|
|
160
|
+
if (!parentId) {
|
|
161
|
+
throw new Error('parentTerminal is set but no parentId is provided');
|
|
162
|
+
}
|
|
163
|
+
return { 'parentTerminal': parentId };
|
|
164
|
+
} else {
|
|
165
|
+
return options.location;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return undefined;
|
|
170
|
+
}
|
|
171
|
+
|
|
151
172
|
$sendText(id: string, text: string, addNewLine?: boolean): void {
|
|
152
173
|
const terminal = this.terminals.getById(id);
|
|
153
174
|
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
|
|