@theia/plugin-ext 1.33.0-next.9 → 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.
Files changed (138) hide show
  1. package/lib/common/collections.d.ts +5 -0
  2. package/lib/common/collections.d.ts.map +1 -0
  3. package/lib/common/collections.js +40 -0
  4. package/lib/common/collections.js.map +1 -0
  5. package/lib/common/plugin-api-rpc-model.d.ts +80 -0
  6. package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
  7. package/lib/common/plugin-api-rpc-model.js +17 -1
  8. package/lib/common/plugin-api-rpc-model.js.map +1 -1
  9. package/lib/common/plugin-api-rpc.d.ts +114 -2
  10. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  11. package/lib/common/plugin-api-rpc.js +12 -8
  12. package/lib/common/plugin-api-rpc.js.map +1 -1
  13. package/lib/common/reference-map.d.ts +8 -0
  14. package/lib/common/reference-map.d.ts.map +1 -0
  15. package/lib/common/reference-map.js +40 -0
  16. package/lib/common/reference-map.js.map +1 -0
  17. package/lib/common/rpc-protocol.d.ts.map +1 -1
  18. package/lib/common/rpc-protocol.js +3 -4
  19. package/lib/common/rpc-protocol.js.map +1 -1
  20. package/lib/common/types.d.ts +5 -1
  21. package/lib/common/types.d.ts.map +1 -1
  22. package/lib/common/types.js +13 -4
  23. package/lib/common/types.js.map +1 -1
  24. package/lib/hosted/node/hosted-plugin-localization-service.d.ts.map +1 -1
  25. package/lib/hosted/node/hosted-plugin-localization-service.js +2 -2
  26. package/lib/hosted/node/hosted-plugin-localization-service.js.map +1 -1
  27. package/lib/hosted/node/plugin-host.d.ts +1 -1
  28. package/lib/hosted/node/plugin-host.d.ts.map +1 -1
  29. package/lib/hosted/node/plugin-host.js +1 -2
  30. package/lib/hosted/node/plugin-host.js.map +1 -1
  31. package/lib/main/browser/comments/comment-thread-widget.d.ts +1 -0
  32. package/lib/main/browser/comments/comment-thread-widget.d.ts.map +1 -1
  33. package/lib/main/browser/comments/comment-thread-widget.js +11 -0
  34. package/lib/main/browser/comments/comment-thread-widget.js.map +1 -1
  35. package/lib/main/browser/custom-editors/custom-editors-main.d.ts.map +1 -1
  36. package/lib/main/browser/custom-editors/custom-editors-main.js +2 -2
  37. package/lib/main/browser/custom-editors/custom-editors-main.js.map +1 -1
  38. package/lib/main/browser/file-system-main-impl.d.ts +1 -0
  39. package/lib/main/browser/file-system-main-impl.d.ts.map +1 -1
  40. package/lib/main/browser/file-system-main-impl.js +9 -2
  41. package/lib/main/browser/file-system-main-impl.js.map +1 -1
  42. package/lib/main/browser/languages-main.d.ts +1 -0
  43. package/lib/main/browser/languages-main.d.ts.map +1 -1
  44. package/lib/main/browser/languages-main.js +10 -0
  45. package/lib/main/browser/languages-main.js.map +1 -1
  46. package/lib/main/browser/tabs/tabs-main.d.ts +10 -0
  47. package/lib/main/browser/tabs/tabs-main.d.ts.map +1 -0
  48. package/lib/main/browser/tabs/tabs-main.js +33 -0
  49. package/lib/main/browser/tabs/tabs-main.js.map +1 -0
  50. package/lib/main/browser/terminal-main.d.ts +7 -4
  51. package/lib/main/browser/terminal-main.d.ts.map +1 -1
  52. package/lib/main/browser/terminal-main.js +24 -4
  53. package/lib/main/browser/terminal-main.js.map +1 -1
  54. package/lib/main/browser/view/tree-view-decorator-service.d.ts +2 -4
  55. package/lib/main/browser/view/tree-view-decorator-service.d.ts.map +1 -1
  56. package/lib/main/browser/view/tree-view-decorator-service.js +1 -2
  57. package/lib/main/browser/view/tree-view-decorator-service.js.map +1 -1
  58. package/lib/main/browser/webview/webview.d.ts +1 -0
  59. package/lib/main/browser/webview/webview.d.ts.map +1 -1
  60. package/lib/main/browser/webview/webview.js.map +1 -1
  61. package/lib/main/browser/webviews-main.d.ts.map +1 -1
  62. package/lib/main/browser/webviews-main.js +6 -6
  63. package/lib/main/browser/webviews-main.js.map +1 -1
  64. package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts +1 -1
  65. package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts.map +1 -1
  66. package/lib/plugin/comments.js +2 -0
  67. package/lib/plugin/comments.js.map +1 -1
  68. package/lib/plugin/file-system-ext-impl.d.ts +2 -0
  69. package/lib/plugin/file-system-ext-impl.d.ts.map +1 -1
  70. package/lib/plugin/file-system-ext-impl.js +22 -5
  71. package/lib/plugin/file-system-ext-impl.js.map +1 -1
  72. package/lib/plugin/languages/code-action.d.ts.map +1 -1
  73. package/lib/plugin/languages/code-action.js +8 -8
  74. package/lib/plugin/languages/code-action.js.map +1 -1
  75. package/lib/plugin/languages/inline-completion.d.ts +21 -0
  76. package/lib/plugin/languages/inline-completion.d.ts.map +1 -0
  77. package/lib/plugin/languages/inline-completion.js +94 -0
  78. package/lib/plugin/languages/inline-completion.js.map +1 -0
  79. package/lib/plugin/languages.d.ts +5 -2
  80. package/lib/plugin/languages.d.ts.map +1 -1
  81. package/lib/plugin/languages.js +16 -1
  82. package/lib/plugin/languages.js.map +1 -1
  83. package/lib/plugin/plugin-context.d.ts.map +1 -1
  84. package/lib/plugin/plugin-context.js +121 -3
  85. package/lib/plugin/plugin-context.js.map +1 -1
  86. package/lib/plugin/preference-registry.d.ts.map +1 -1
  87. package/lib/plugin/preference-registry.js +4 -2
  88. package/lib/plugin/preference-registry.js.map +1 -1
  89. package/lib/plugin/tabs.d.ts +23 -0
  90. package/lib/plugin/tabs.d.ts.map +1 -0
  91. package/lib/plugin/tabs.js +362 -0
  92. package/lib/plugin/tabs.js.map +1 -0
  93. package/lib/plugin/terminal-ext.d.ts.map +1 -1
  94. package/lib/plugin/terminal-ext.js +13 -1
  95. package/lib/plugin/terminal-ext.js.map +1 -1
  96. package/lib/plugin/theming.d.ts.map +1 -1
  97. package/lib/plugin/theming.js +3 -0
  98. package/lib/plugin/theming.js.map +1 -1
  99. package/lib/plugin/type-converters.d.ts +4 -0
  100. package/lib/plugin/type-converters.d.ts.map +1 -1
  101. package/lib/plugin/type-converters.js +53 -43
  102. package/lib/plugin/type-converters.js.map +1 -1
  103. package/lib/plugin/types-impl.d.ts +195 -2
  104. package/lib/plugin/types-impl.d.ts.map +1 -1
  105. package/lib/plugin/types-impl.js +278 -14
  106. package/lib/plugin/types-impl.js.map +1 -1
  107. package/package.json +26 -26
  108. package/src/common/collections.ts +37 -0
  109. package/src/common/plugin-api-rpc-model.ts +98 -0
  110. package/src/common/plugin-api-rpc.ts +150 -11
  111. package/src/common/reference-map.ts +38 -0
  112. package/src/common/rpc-protocol.ts +2 -3
  113. package/src/common/types.ts +15 -4
  114. package/src/hosted/node/hosted-plugin-localization-service.ts +3 -3
  115. package/src/hosted/node/plugin-host.ts +1 -2
  116. package/src/main/browser/comments/comment-thread-widget.tsx +11 -0
  117. package/src/main/browser/custom-editors/custom-editors-main.ts +2 -1
  118. package/src/main/browser/file-system-main-impl.ts +12 -3
  119. package/src/main/browser/languages-main.ts +18 -1
  120. package/src/main/browser/style/comments.css +6 -0
  121. package/src/main/browser/tabs/tabs-main.ts +42 -0
  122. package/src/main/browser/terminal-main.ts +25 -6
  123. package/src/main/browser/view/tree-view-decorator-service.ts +4 -5
  124. package/src/main/browser/webview/pre/main.js +8 -1
  125. package/src/main/browser/webview/webview.ts +1 -0
  126. package/src/main/browser/webviews-main.ts +6 -3
  127. package/src/plugin/comments.ts +2 -0
  128. package/src/plugin/file-system-ext-impl.ts +21 -5
  129. package/src/plugin/languages/code-action.ts +8 -8
  130. package/src/plugin/languages/inline-completion.ts +126 -0
  131. package/src/plugin/languages.ts +30 -3
  132. package/src/plugin/plugin-context.ts +166 -5
  133. package/src/plugin/preference-registry.ts +4 -2
  134. package/src/plugin/tabs.ts +430 -0
  135. package/src/plugin/terminal-ext.ts +16 -1
  136. package/src/plugin/theming.ts +3 -0
  137. package/src/plugin/type-converters.ts +58 -46
  138. package/src/plugin/types-impl.ts +300 -9
@@ -81,7 +81,10 @@ import {
81
81
  InlayHint,
82
82
  CachedSession,
83
83
  CachedSessionItem,
84
- TypeHierarchyItem
84
+ TypeHierarchyItem,
85
+ InlineCompletion,
86
+ InlineCompletions,
87
+ InlineCompletionContext
85
88
  } from './plugin-api-rpc-model';
86
89
  import { ExtPluginApi } from './plugin-ext-api-contribution';
87
90
  import { KeysToAnyValues, KeysToKeysToAnyValue } from './types';
@@ -107,7 +110,7 @@ import type {
107
110
  import { SerializableEnvironmentVariableCollection } from '@theia/terminal/lib/common/base-terminal-protocol';
108
111
  import { ThemeType } from '@theia/core/lib/common/theme';
109
112
  import { Disposable } from '@theia/core/lib/common/disposable';
110
- import { PickOptions, QuickInputButtonHandle } from '@theia/core/lib/common';
113
+ import { isObject, PickOptions, QuickInputButtonHandle } from '@theia/core/lib/common';
111
114
  import { Severity } from '@theia/core/lib/common/severity';
112
115
  import { DebugConfiguration, DebugSessionOptions } from '@theia/debug/lib/common/debug-configuration';
113
116
 
@@ -300,7 +303,7 @@ export interface TerminalServiceMain {
300
303
  * Create new Terminal with Terminal options.
301
304
  * @param options - object with parameters to create new terminal.
302
305
  */
303
- $createTerminal(id: string, options: theia.TerminalOptions, isPseudoTerminal?: boolean): Promise<string>;
306
+ $createTerminal(id: string, options: theia.TerminalOptions, parentId?: string, isPseudoTerminal?: boolean): Promise<string>;
304
307
 
305
308
  /**
306
309
  * Send text to the terminal by id.
@@ -777,7 +780,7 @@ export interface TreeViewSelection {
777
780
  }
778
781
  export namespace TreeViewSelection {
779
782
  export function is(arg: unknown): arg is TreeViewSelection {
780
- return !!arg && typeof arg === 'object' && 'treeViewId' in arg && 'treeItemId' in arg;
783
+ return isObject(arg) && 'treeViewId' in arg && 'treeItemId' in arg;
781
784
  }
782
785
  }
783
786
 
@@ -823,7 +826,7 @@ export interface ScmCommandArg {
823
826
  }
824
827
  export namespace ScmCommandArg {
825
828
  export function is(arg: unknown): arg is ScmCommandArg {
826
- return !!arg && typeof arg === 'object' && 'sourceControlHandle' in arg;
829
+ return isObject(arg) && 'sourceControlHandle' in arg;
827
830
  }
828
831
  }
829
832
 
@@ -839,7 +842,7 @@ export interface ScmExt {
839
842
 
840
843
  export namespace TimelineCommandArg {
841
844
  export function is(arg: unknown): arg is TimelineCommandArg {
842
- return !!arg && typeof arg === 'object' && 'timelineHandle' in arg;
845
+ return isObject(arg) && 'timelineHandle' in arg;
843
846
  }
844
847
  }
845
848
  export interface TimelineCommandArg {
@@ -858,7 +861,7 @@ export interface DecorationReply { [id: number]: DecorationData; }
858
861
 
859
862
  export namespace CommentsCommandArg {
860
863
  export function is(arg: unknown): arg is CommentsCommandArg {
861
- return !!arg && typeof arg === 'object' && 'commentControlHandle' in arg && 'commentThreadHandle' in arg && 'text' in arg && !('commentUniqueId' in arg);
864
+ return isObject(arg) && 'commentControlHandle' in arg && 'commentThreadHandle' in arg && 'text' in arg && !('commentUniqueId' in arg);
862
865
  }
863
866
  }
864
867
  export interface CommentsCommandArg {
@@ -869,7 +872,7 @@ export interface CommentsCommandArg {
869
872
 
870
873
  export namespace CommentsContextCommandArg {
871
874
  export function is(arg: unknown): arg is CommentsContextCommandArg {
872
- return !!arg && typeof arg === 'object' && 'commentControlHandle' in arg && 'commentThreadHandle' in arg && 'commentUniqueId' in arg && !('text' in arg);
875
+ return isObject(arg) && 'commentControlHandle' in arg && 'commentThreadHandle' in arg && 'commentUniqueId' in arg && !('text' in arg);
873
876
  }
874
877
  }
875
878
  export interface CommentsContextCommandArg {
@@ -880,7 +883,7 @@ export interface CommentsContextCommandArg {
880
883
 
881
884
  export namespace CommentsEditCommandArg {
882
885
  export function is(arg: unknown): arg is CommentsEditCommandArg {
883
- return !!arg && typeof arg === 'object' && 'commentControlHandle' in arg && 'commentThreadHandle' in arg && 'commentUniqueId' in arg && 'text' in arg;
886
+ return isObject(arg) && 'commentControlHandle' in arg && 'commentThreadHandle' in arg && 'commentUniqueId' in arg && 'text' in arg;
884
887
  }
885
888
  }
886
889
  export interface CommentsEditCommandArg {
@@ -1581,6 +1584,8 @@ export interface LanguagesExt {
1581
1584
  $provideSuperTypes(handle: number, sessionId: string, itemId: string, token: theia.CancellationToken): Promise<TypeHierarchyItem[] | undefined>
1582
1585
  $provideSubTypes(handle: number, sessionId: string, itemId: string, token: theia.CancellationToken): Promise<TypeHierarchyItem[] | undefined>;
1583
1586
  $releaseTypeHierarchy(handle: number, session?: string): Promise<boolean>;
1587
+ $provideInlineCompletions(handle: number, resource: UriComponents, position: Position, context: InlineCompletionContext, token: CancellationToken): Promise<IdentifiableInlineCompletions | undefined>;
1588
+ $freeInlineCompletionsList(handle: number, pid: number): void;
1584
1589
  }
1585
1590
 
1586
1591
  export const LanguagesMainFactory = Symbol('LanguagesMainFactory');
@@ -1638,6 +1643,7 @@ export interface LanguagesMain {
1638
1643
  $registerTypeHierarchyProvider(handle: number, selector: SerializedDocumentFilter[]): void;
1639
1644
  $setLanguageStatus(handle: number, status: LanguageStatus): void;
1640
1645
  $removeLanguageStatus(handle: number): void;
1646
+ $registerInlineCompletionsSupport(handle: number, selector: SerializedDocumentFilter[]): void;
1641
1647
  }
1642
1648
 
1643
1649
  export interface WebviewInitData {
@@ -1829,6 +1835,7 @@ export interface DebugMain {
1829
1835
  }
1830
1836
 
1831
1837
  export interface FileSystemExt {
1838
+ $acceptProviderInfos(scheme: string, capabilities?: files.FileSystemProviderCapabilities): void;
1832
1839
  $stat(handle: number, resource: UriComponents): Promise<files.Stat>;
1833
1840
  $readdir(handle: number, resource: UriComponents): Promise<[string, files.FileType][]>;
1834
1841
  $readFile(handle: number, resource: UriComponents): Promise<BinaryBuffer>;
@@ -1912,6 +1919,128 @@ export interface CommentsMain {
1912
1919
  $onDidCommentThreadsChange(handle: number, event: CommentThreadChangedEvent): void;
1913
1920
  }
1914
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
+
1915
2044
  export const PLUGIN_RPC_CONTEXT = {
1916
2045
  AUTHENTICATION_MAIN: <ProxyIdentifier<AuthenticationMain>>createProxyIdentifier<AuthenticationMain>('AuthenticationMain'),
1917
2046
  COMMAND_REGISTRY_MAIN: <ProxyIdentifier<CommandRegistryMain>>createProxyIdentifier<CommandRegistryMain>('CommandRegistryMain'),
@@ -1945,7 +2074,8 @@ export const PLUGIN_RPC_CONTEXT = {
1945
2074
  LABEL_SERVICE_MAIN: <ProxyIdentifier<LabelServiceMain>>createProxyIdentifier<LabelServiceMain>('LabelServiceMain'),
1946
2075
  TIMELINE_MAIN: <ProxyIdentifier<TimelineMain>>createProxyIdentifier<TimelineMain>('TimelineMain'),
1947
2076
  THEMING_MAIN: <ProxyIdentifier<ThemingMain>>createProxyIdentifier<ThemingMain>('ThemingMain'),
1948
- COMMENTS_MAIN: <ProxyIdentifier<CommentsMain>>createProxyIdentifier<CommentsMain>('CommentsMain')
2077
+ COMMENTS_MAIN: <ProxyIdentifier<CommentsMain>>createProxyIdentifier<CommentsMain>('CommentsMain'),
2078
+ TABS_MAIN: <ProxyIdentifier<TabsMain>>createProxyIdentifier<TabsMain>('TabsMain')
1949
2079
  };
1950
2080
 
1951
2081
  export const MAIN_RPC_CONTEXT = {
@@ -1979,7 +2109,8 @@ export const MAIN_RPC_CONTEXT = {
1979
2109
  LABEL_SERVICE_EXT: createProxyIdentifier<LabelServiceExt>('LabelServiceExt'),
1980
2110
  TIMELINE_EXT: createProxyIdentifier<TimelineExt>('TimeLineExt'),
1981
2111
  THEMING_EXT: createProxyIdentifier<ThemingExt>('ThemingExt'),
1982
- COMMENTS_EXT: createProxyIdentifier<CommentsExt>('CommentsExt')
2112
+ COMMENTS_EXT: createProxyIdentifier<CommentsExt>('CommentsExt'),
2113
+ TABS_EXT: createProxyIdentifier<TabsExt>('TabsExt')
1983
2114
  };
1984
2115
 
1985
2116
  export interface TasksExt {
@@ -2043,3 +2174,11 @@ export interface SecretsMain {
2043
2174
 
2044
2175
  export type InlayHintDto = CachedSessionItem<InlayHint>;
2045
2176
  export type InlayHintsDto = CachedSession<{ hints: InlayHint[] }>;
2177
+
2178
+ export interface IdentifiableInlineCompletions extends InlineCompletions<IdentifiableInlineCompletion> {
2179
+ pid: number;
2180
+ }
2181
+
2182
+ export interface IdentifiableInlineCompletion extends InlineCompletion {
2183
+ idx: number;
2184
+ }
@@ -0,0 +1,38 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2022 Ericsson 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
+ // copied from hhttps://github.com/microsoft/vscode/blob/6261075646f055b99068d3688932416f2346dd3b/src/vs/workbench/api/common/extHostLanguageFeatures.ts#L1291-L1310.
18
+
19
+ export class ReferenceMap<T> {
20
+ private readonly _references = new Map<number, T>();
21
+ private _idPool = 1;
22
+
23
+ createReferenceId(value: T): number {
24
+ const id = this._idPool++;
25
+ this._references.set(id, value);
26
+ return id;
27
+ }
28
+
29
+ disposeReferenceId(referenceId: number): T | undefined {
30
+ const value = this._references.get(referenceId);
31
+ this._references.delete(referenceId);
32
+ return value;
33
+ }
34
+
35
+ get(referenceId: number): T | undefined {
36
+ return this._references.get(referenceId);
37
+ }
38
+ }
@@ -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 !!error && typeof error === 'object' && 'code' in error && (error as ConnectionClosedError).code === code;
76
+ return isObject(error) && 'code' in error && (error as ConnectionClosedError).code === code;
78
77
  }
79
78
  }
80
79
 
@@ -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
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
- export function isObject(obj: any): boolean {
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 typeof obj === 'object' && obj && 'message' in obj || false;
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 (typeof value === 'object' && value) {
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
- // eslint-disable-next-line import/no-extraneous-dependencies
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 {
@@ -223,11 +223,12 @@ export class CustomEditorsMainImpl implements CustomEditorsMain, Disposable {
223
223
  const view = await this.widgetManager.getOrCreateWidget<CustomEditorWidget>(CustomEditorWidget.FACTORY_ID, <WebviewWidgetIdentifier>{ id: panelId });
224
224
  this.webviewsMain.hookWebview(view);
225
225
  view.title.label = title;
226
- const { enableFindWidget, retainContextWhenHidden, enableScripts, localResourceRoots, ...contentOptions } = options;
226
+ const { enableFindWidget, retainContextWhenHidden, enableScripts, enableForms, localResourceRoots, ...contentOptions } = options;
227
227
  view.viewColumn = ViewColumn.One; // behaviour might be overridden later using widgetOpenerOptions (if available)
228
228
  view.options = { enableFindWidget, retainContextWhenHidden };
229
229
  view.setContentOptions({
230
230
  allowScripts: enableScripts,
231
+ allowForms: enableForms,
231
232
  localResourceRoots: localResourceRoots && localResourceRoots.map(root => root.toString()),
232
233
  ...contentOptions,
233
234
  ...view.contentOptions
@@ -27,7 +27,7 @@ import { URI } from '@theia/core/shared/vscode-uri';
27
27
  import { interfaces } from '@theia/core/shared/inversify';
28
28
  import CoreURI from '@theia/core/lib/common/uri';
29
29
  import { BinaryBuffer } from '@theia/core/lib/common/buffer';
30
- import { Disposable } from '@theia/core/lib/common/disposable';
30
+ import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable';
31
31
  import { Event, Emitter } from '@theia/core/lib/common/event';
32
32
  import { MAIN_RPC_CONTEXT, FileSystemMain, FileSystemExt, IFileChangeDto } from '../../common/plugin-api-rpc';
33
33
  import { RPCProtocol } from '../../common/rpc-protocol';
@@ -46,15 +46,24 @@ export class FileSystemMainImpl implements FileSystemMain, Disposable {
46
46
  private readonly _proxy: FileSystemExt;
47
47
  private readonly _fileProvider = new Map<number, RemoteFileSystemProvider>();
48
48
  private readonly _fileService: FileService;
49
+ private readonly _disposables = new DisposableCollection();
49
50
 
50
51
  constructor(rpc: RPCProtocol, container: interfaces.Container) {
51
52
  this._proxy = rpc.getProxy(MAIN_RPC_CONTEXT.FILE_SYSTEM_EXT);
52
53
  this._fileService = container.get(FileService);
54
+
55
+ for (const { scheme, capabilities } of this._fileService.listCapabilities()) {
56
+ this._proxy.$acceptProviderInfos(scheme, capabilities);
57
+ }
58
+
59
+ this._disposables.push(this._fileService.onDidChangeFileSystemProviderRegistrations(e => this._proxy.$acceptProviderInfos(e.scheme, e.provider?.capabilities)));
60
+ this._disposables.push(this._fileService.onDidChangeFileSystemProviderCapabilities(e => this._proxy.$acceptProviderInfos(e.scheme, e.provider.capabilities)));
61
+ this._disposables.push(Disposable.create(() => this._fileProvider.forEach(value => value.dispose())));
62
+ this._disposables.push(Disposable.create(() => this._fileProvider.clear()));
53
63
  }
54
64
 
55
65
  dispose(): void {
56
- this._fileProvider.forEach(value => value.dispose());
57
- this._fileProvider.clear();
66
+ this._disposables.dispose();
58
67
  }
59
68
 
60
69
  $registerFileSystemProvider(handle: number, scheme: string, capabilities: FileSystemProviderCapabilities): void {
@@ -34,7 +34,8 @@ import {
34
34
  WorkspaceTextEditDto,
35
35
  PluginInfo,
36
36
  LanguageStatus as LanguageStatusDTO,
37
- InlayHintDto
37
+ InlayHintDto,
38
+ IdentifiableInlineCompletions
38
39
  } from '../../common/plugin-api-rpc';
39
40
  import { injectable, inject } from '@theia/core/shared/inversify';
40
41
  import {
@@ -868,6 +869,22 @@ export class LanguagesMainImpl implements LanguagesMain, Disposable {
868
869
  }
869
870
  }
870
871
 
872
+ $registerInlineCompletionsSupport(handle: number, selector: SerializedDocumentFilter[]): void {
873
+ const languageSelector = this.toLanguageSelector(selector);
874
+ const provider: monaco.languages.InlineCompletionsProvider<IdentifiableInlineCompletions> = {
875
+ provideInlineCompletions: async (
876
+ model: monaco.editor.ITextModel,
877
+ position: monaco.Position,
878
+ context: monaco.languages.InlineCompletionContext,
879
+ token: CancellationToken
880
+ ): Promise<IdentifiableInlineCompletions | undefined> => this.proxy.$provideInlineCompletions(handle, model.uri, position, context, token),
881
+ freeInlineCompletions: (completions: IdentifiableInlineCompletions): void => {
882
+ this.proxy.$freeInlineCompletionsList(handle, completions.pid);
883
+ }
884
+ };
885
+ this.register(handle, (monaco.languages.registerInlineCompletionsProvider as RegistrationFunction<monaco.languages.InlineCompletionsProvider>)(languageSelector, provider));
886
+ }
887
+
871
888
  $registerQuickFixProvider(
872
889
  handle: number,
873
890
  pluginInfo: PluginInfo,
@@ -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 { TerminalWidget } from '@theia/terminal/lib/browser/base/terminal-widget';
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
- isPseudoTerminal
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) {
@@ -260,11 +279,11 @@ export class TerminalServiceMainImpl implements TerminalServiceMain, TerminalLin
260
279
  }
261
280
  }
262
281
 
263
- async provideLinks(line: string, terminal: TerminalWidget, cancelationToken?: CancellationToken | undefined): Promise<TerminalLink[]> {
282
+ async provideLinks(line: string, terminal: TerminalWidget, cancellationToken?: CancellationToken | undefined): Promise<TerminalLink[]> {
264
283
  if (this.terminalLinkProviders.length < 1) {
265
284
  return [];
266
285
  }
267
- const links = await this.extProxy.$provideTerminalLinks(line, terminal.id, cancelationToken ?? CancellationToken.None);
286
+ const links = await this.extProxy.$provideTerminalLinks(line, terminal.id, cancellationToken ?? CancellationToken.None);
268
287
  return links.map(link => ({ ...link, handle: () => this.extProxy.$handleTerminalLink(link) }));
269
288
  }
270
289
 
@@ -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, Uri } from '@theia/plugin';
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 & { resourceUri: Uri } {
36
- const candidate = node as TreeItem;
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