@codingame/monaco-vscode-api 1.79.2-next.1 → 1.79.2-next.2

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.
@@ -1,5 +1,5 @@
1
1
  import * as vscode from 'vscode';
2
- import { a as IExtensionDescription, b as IExtensionManifest } from './extensions.d2.ts';
2
+ import { b as IExtensionDescription, I as IExtensionManifest } from './extensions.d2.ts';
3
3
  export { c as IExtensionContributions } from './extensions.d2.ts';
4
4
  import { I as IMessage } from './extensionsRegistry.js';
5
5
  import { a as IDisposable } from './event.js';
@@ -443,4 +443,4 @@ interface IRelaxedExtensionDescription extends IRelaxedExtensionManifest {
443
443
  }
444
444
  type IExtensionDescription = Readonly<IRelaxedExtensionDescription>;
445
445
 
446
- export { ExtensionIdentifier as E, ILocalizedString as I, TargetPlatform as T, IExtensionDescription as a, IExtensionManifest as b, IExtensionContributions as c, ExtensionKind as d, ICommandAction as e, ICommandActionTitle as f, Icon as g, IEnvironmentService as h };
446
+ export { ExtensionIdentifier as E, IExtensionManifest as I, TargetPlatform as T, ILocalizedString as a, IExtensionDescription as b, IExtensionContributions as c, ExtensionKind as d, ICommandAction as e, ICommandActionTitle as f, Icon as g, IEnvironmentService as h };
@@ -1,5 +1,5 @@
1
1
  import { S as ServiceIdentifier } from './instantiation.js';
2
- import { E as ExtensionIdentifier, a as IExtensionDescription, c as IExtensionContributions, d as ExtensionKind } from './extensions.d2.ts';
2
+ import { E as ExtensionIdentifier, b as IExtensionDescription, c as IExtensionContributions, d as ExtensionKind } from './extensions.d2.ts';
3
3
  import { E as Event } from './event.js';
4
4
  import { S as Severity } from './severity.js';
5
5
 
@@ -1,13 +1,21 @@
1
1
  import { FilterPattern } from '@rollup/pluginutils';
2
2
  import { Plugin, InputPluginOption } from 'rollup';
3
+ import { I as IExtensionManifest } from './extensions.d2.ts';
4
+ import './uri.js';
5
+ import './contextkey.js';
6
+ import './instantiation.js';
7
+ import './event.js';
8
+ import 'vscode';
9
+ import './themables.js';
3
10
 
4
11
  interface Options {
5
12
  include?: FilterPattern;
6
13
  exclude?: FilterPattern;
7
14
  isDefaultExtension?: boolean;
8
15
  withCode?: (extensionPath: string) => boolean;
9
- rollupPlugins: InputPluginOption[];
16
+ rollupPlugins?: InputPluginOption[];
17
+ transformManifest?: (manifest: IExtensionManifest) => IExtensionManifest;
10
18
  }
11
- declare function plugin({ include, exclude, isDefaultExtension, withCode, rollupPlugins }: Options): Plugin;
19
+ declare function plugin({ include, exclude, isDefaultExtension, withCode, rollupPlugins, transformManifest }: Options): Plugin;
12
20
 
13
21
  export { plugin as default };
@@ -11,7 +11,7 @@ import 'node:crypto';
11
11
  import 'node:fs/promises';
12
12
  import 'tty';
13
13
 
14
- function plugin({ include, exclude, isDefaultExtension = false, withCode = () => true, rollupPlugins }) {
14
+ function plugin({ include, exclude, isDefaultExtension = false, withCode = () => true, rollupPlugins = [], transformManifest = manifest => manifest }) {
15
15
  const filter = createFilter(include, exclude);
16
16
  return {
17
17
  name: 'default-extensions-loader',
@@ -36,7 +36,7 @@ function plugin({ include, exclude, isDefaultExtension = false, withCode = () =>
36
36
  parsed = localizeManifest(parsed, parseJson(id, (await fsPromise.readFile(nlsFile)).toString()));
37
37
  }
38
38
  return {
39
- code: dataToEsm(parsed, {
39
+ code: dataToEsm(transformManifest(parsed), {
40
40
  compact: true,
41
41
  namedExports: false,
42
42
  preferConst: false
@@ -1,12 +1,20 @@
1
1
  import { FilterPattern } from '@rollup/pluginutils';
2
2
  import { Plugin, InputPluginOption } from 'rollup';
3
+ import { I as IExtensionManifest } from './extensions.d2.ts';
4
+ import './uri.js';
5
+ import './contextkey.js';
6
+ import './instantiation.js';
7
+ import './event.js';
8
+ import 'vscode';
9
+ import './themables.js';
3
10
 
4
11
  interface Options {
5
12
  include?: FilterPattern;
6
13
  exclude?: FilterPattern;
7
14
  withCode?: (extensionPath: string) => boolean;
8
- rollupPlugins: InputPluginOption[];
15
+ rollupPlugins?: InputPluginOption[];
16
+ transformManifest?: (manifest: IExtensionManifest) => IExtensionManifest;
9
17
  }
10
- declare function plugin({ include, exclude, rollupPlugins, withCode }: Options): Plugin;
18
+ declare function plugin({ include, exclude, rollupPlugins, withCode, transformManifest }: Options): Plugin;
11
19
 
12
20
  export { plugin as default };
@@ -53,7 +53,7 @@ async function readVsix(file) {
53
53
  function getVsixPath(file) {
54
54
  return path.relative('/', path.resolve('/', file));
55
55
  }
56
- function plugin({ include = '**/*.vsix', exclude, rollupPlugins, withCode = () => true }) {
56
+ function plugin({ include = '**/*.vsix', exclude, rollupPlugins = [], withCode = () => true, transformManifest = manifest => manifest }) {
57
57
  const filter = createFilter(include, exclude);
58
58
  const vsixFiles = {};
59
59
  return {
@@ -100,11 +100,13 @@ function plugin({ include = '**/*.vsix', exclude, rollupPlugins, withCode = () =
100
100
  const file = match[2];
101
101
  const vsixFile = vsixFiles[match[1]];
102
102
  let parsed = parseJson(id, vsixFile[file].toString('utf8'));
103
- if (file === 'package.json' && 'package.nls.json' in vsixFile) {
104
- parsed = localizeManifest(parsed, parseJson(id, vsixFile['package.nls.json'].toString()));
103
+ if (file === 'package.json') {
104
+ if ('package.nls.json' in vsixFile) {
105
+ parsed = localizeManifest(parsed, parseJson(id, vsixFile['package.nls.json'].toString()));
106
+ }
105
107
  }
106
108
  return {
107
- code: dataToEsm(parsed, {
109
+ code: dataToEsm(transformManifest(parsed), {
108
110
  compact: true,
109
111
  namedExports: false,
110
112
  preferConst: false
@@ -19,7 +19,7 @@ import { I as IconIdentifier, T as ThemeIcon } from './themables.js';
19
19
  import { I as IJSONSchema, a as IJSONSchemaMap } from './jsonSchema.js';
20
20
  import { I as IView$3, a as IViewDescriptorService, b as IViewPaneContainer, c as ViewContainer, d as IViewContainerModel, e as IViewDescriptor, f as IAddedViewDescriptorRef, g as IPaneComposite, V as ViewContainerLocation } from './views.js';
21
21
  export { h as IViewsService } from './views.js';
22
- import { e as ICommandAction, f as ICommandActionTitle, g as Icon, h as IEnvironmentService, E as ExtensionIdentifier, T as TargetPlatform, a as IExtensionDescription } from './extensions.d2.ts';
22
+ import { e as ICommandAction, f as ICommandActionTitle, g as Icon, h as IEnvironmentService, E as ExtensionIdentifier, T as TargetPlatform, b as IExtensionDescription } from './extensions.d2.ts';
23
23
  import { b as IProgress, c as IProgressStep, I as IComposite, d as ICompositeControl, a as IProgressIndicator } from './composite.js';
24
24
  import { a as IContextKeyService, C as ContextKeyExpression } from './contextkey.js';
25
25
  import { a as IExtensionService } from './extensionsRegistry.js';
package/dist/views.d.ts CHANGED
@@ -3,7 +3,7 @@ import { U as URI } from './uri.js';
3
3
  import { E as Event } from './event.js';
4
4
  import { T as ThemeIcon } from './themables.js';
5
5
  import { C as ContextKeyExpression } from './contextkey.js';
6
- import { I as ILocalizedString, E as ExtensionIdentifier } from './extensions.d2.ts';
6
+ import { a as ILocalizedString, E as ExtensionIdentifier } from './extensions.d2.ts';
7
7
  import { I as IComposite, a as IProgressIndicator } from './composite.js';
8
8
 
9
9
  interface IKeybindings {
@@ -21,6 +21,12 @@ import { CommandsRegistry } from 'monaco-editor/esm/vs/platform/commands/common/
21
21
  import { assertType } from 'monaco-editor/esm/vs/base/common/types.js';
22
22
  import { getWorkspaceSymbols } from '../common/search.js';
23
23
  import { ShowAllSymbolsActionId } from '../common/constants.js';
24
+ import './searchActionsCopy.js';
25
+ import './searchActionsFind.js';
26
+ import './searchActionsNav.js';
27
+ import './searchActionsRemoveReplace.js';
28
+ import './searchActionsSymbol.js';
29
+ import './searchActionsTopBar.js';
24
30
  registerContributions();
25
31
  registerContributions$1();
26
32
  const SEARCH_MODE_CONFIG = 'search.mode';
@@ -1,5 +1,8 @@
1
1
  import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
2
+ import * as nls from 'monaco-editor/esm/vs/nls.js';
3
+ import { searchComparer, FileMatch, Match, FolderMatch } from './searchModel.js';
2
4
  import { VIEW_ID } from '../../../services/search/common/search.js';
5
+ const category = { value: ( nls.localize('search', "Search")), original: 'Search' };
3
6
  function isSearchViewFocused(viewsService) {
4
7
  const searchView = getSearchView(viewsService);
5
8
  const activeElement = document.activeElement;
@@ -11,7 +14,33 @@ function appendKeyBindingLabel(label, inputKeyBinding) {
11
14
  function getSearchView(viewsService) {
12
15
  return viewsService.getActiveViewWithId(VIEW_ID);
13
16
  }
17
+ function getElementsToOperateOn(viewer, currElement, sortConfig) {
18
+ let elements = viewer.getSelection().filter((x) => x !== null).sort((a, b) => searchComparer(a, b, sortConfig.sortOrder));
19
+ if (currElement && !(elements.length > 1 && elements.includes(currElement))) {
20
+ elements = [currElement];
21
+ }
22
+ return elements;
23
+ }
24
+ function shouldRefocus(elements, focusElement) {
25
+ if (!focusElement) {
26
+ return false;
27
+ }
28
+ return !focusElement || elements.includes(focusElement) || hasDownstreamMatch(elements, focusElement);
29
+ }
30
+ function hasDownstreamMatch(elements, focusElement) {
31
+ for (const elem of elements) {
32
+ if ((elem instanceof FileMatch && focusElement instanceof Match && elem.matches().includes(focusElement)) ||
33
+ (elem instanceof FolderMatch && ((focusElement instanceof FileMatch && elem.getDownstreamFileMatch(focusElement.resource)) ||
34
+ (focusElement instanceof Match && elem.getDownstreamFileMatch(focusElement.parent().resource))))) {
35
+ return true;
36
+ }
37
+ }
38
+ return false;
39
+ }
40
+ function openSearchView(viewsService, focus) {
41
+ return viewsService.openView(VIEW_ID, focus).then(view => (view ?? undefined));
42
+ }
14
43
  function doAppendKeyBindingLabel(label, keyBinding) {
15
44
  return keyBinding ? label + ' (' + keyBinding.getLabel() + ')' : label;
16
45
  }
17
- export { appendKeyBindingLabel, getSearchView, isSearchViewFocused };
46
+ export { appendKeyBindingLabel, category, getElementsToOperateOn, getSearchView, isSearchViewFocused, openSearchView, shouldRefocus };
@@ -0,0 +1,204 @@
1
+ import * as nls from 'monaco-editor/esm/vs/nls.js';
2
+ import { IClipboardService } from 'monaco-editor/esm/vs/platform/clipboard/common/clipboardService.js';
3
+ import { ILabelService } from 'monaco-editor/esm/vs/platform/label/common/label.js';
4
+ import { IViewsService } from '../../../common/views.js';
5
+ import { CopyMatchCommandId, FileMatchOrMatchFocusKey, CopyPathCommandId, FileMatchOrFolderMatchWithResourceFocusKey, CopyAllCommandId, HasSearchResults } from '../common/constants.js';
6
+ import { FileMatch, FolderMatchWithResource, Match, FolderMatch, searchMatchComparer } from './searchModel.js';
7
+ import { registerAction2, Action2, MenuId } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
8
+ import { category, getSearchView } from './searchActionsBase.js';
9
+ import { isWindows } from 'monaco-editor/esm/vs/base/common/platform.js';
10
+ registerAction2(class CopyMatchCommandAction extends Action2 {
11
+ constructor() {
12
+ super({
13
+ id: CopyMatchCommandId,
14
+ title: {
15
+ value: ( nls.localize('copyMatchLabel', "Copy")),
16
+ original: 'Copy'
17
+ },
18
+ category,
19
+ keybinding: {
20
+ weight: 200 ,
21
+ when: FileMatchOrMatchFocusKey,
22
+ primary: 2048 | 33 ,
23
+ },
24
+ menu: [{
25
+ id: MenuId.SearchContext,
26
+ when: FileMatchOrMatchFocusKey,
27
+ group: 'search_2',
28
+ order: 1
29
+ }]
30
+ });
31
+ }
32
+ async run(accessor, match) {
33
+ await copyMatchCommand(accessor, match);
34
+ }
35
+ });
36
+ registerAction2(class CopyPathCommandAction extends Action2 {
37
+ constructor() {
38
+ super({
39
+ id: CopyPathCommandId,
40
+ title: {
41
+ value: ( nls.localize('copyPathLabel', "Copy Path")),
42
+ original: 'Copy Path'
43
+ },
44
+ category,
45
+ keybinding: {
46
+ weight: 200 ,
47
+ when: FileMatchOrFolderMatchWithResourceFocusKey,
48
+ primary: 2048 | 512 | 33 ,
49
+ win: {
50
+ primary: 1024 | 512 | 33
51
+ },
52
+ },
53
+ menu: [{
54
+ id: MenuId.SearchContext,
55
+ when: FileMatchOrFolderMatchWithResourceFocusKey,
56
+ group: 'search_2',
57
+ order: 2
58
+ }]
59
+ });
60
+ }
61
+ async run(accessor, fileMatch) {
62
+ await copyPathCommand(accessor, fileMatch);
63
+ }
64
+ });
65
+ registerAction2(class CopyAllCommandAction extends Action2 {
66
+ constructor() {
67
+ super({
68
+ id: CopyAllCommandId,
69
+ title: {
70
+ value: ( nls.localize('copyAllLabel', "Copy All")),
71
+ original: 'Copy All'
72
+ },
73
+ category,
74
+ menu: [{
75
+ id: MenuId.SearchContext,
76
+ when: HasSearchResults,
77
+ group: 'search_2',
78
+ order: 3
79
+ }]
80
+ });
81
+ }
82
+ async run(accessor) {
83
+ await copyAllCommand(accessor);
84
+ }
85
+ });
86
+ const lineDelimiter = isWindows ? '\r\n' : '\n';
87
+ async function copyPathCommand(accessor, fileMatch) {
88
+ if (!fileMatch) {
89
+ const selection = getSelectedRow(accessor);
90
+ if (!(selection instanceof FileMatch || selection instanceof FolderMatchWithResource)) {
91
+ return;
92
+ }
93
+ fileMatch = selection;
94
+ }
95
+ const clipboardService = accessor.get(IClipboardService);
96
+ const labelService = accessor.get(ILabelService);
97
+ const text = labelService.getUriLabel(fileMatch.resource, { noPrefix: true });
98
+ await clipboardService.writeText(text);
99
+ }
100
+ async function copyMatchCommand(accessor, match) {
101
+ if (!match) {
102
+ const selection = getSelectedRow(accessor);
103
+ if (!selection) {
104
+ return;
105
+ }
106
+ match = selection;
107
+ }
108
+ const clipboardService = accessor.get(IClipboardService);
109
+ const labelService = accessor.get(ILabelService);
110
+ let text;
111
+ if (match instanceof Match) {
112
+ text = matchToString(match);
113
+ }
114
+ else if (match instanceof FileMatch) {
115
+ text = fileMatchToString(match, labelService).text;
116
+ }
117
+ else if (match instanceof FolderMatch) {
118
+ text = folderMatchToString(match, labelService).text;
119
+ }
120
+ if (text) {
121
+ await clipboardService.writeText(text);
122
+ }
123
+ }
124
+ async function copyAllCommand(accessor) {
125
+ const viewsService = accessor.get(IViewsService);
126
+ const clipboardService = accessor.get(IClipboardService);
127
+ const labelService = accessor.get(ILabelService);
128
+ const searchView = getSearchView(viewsService);
129
+ if (searchView) {
130
+ const root = searchView.searchResult;
131
+ const text = allFolderMatchesToString(root.folderMatches(), labelService);
132
+ await clipboardService.writeText(text);
133
+ }
134
+ }
135
+ function matchToString(match, indent = 0) {
136
+ const getFirstLinePrefix = () => `${match.range().startLineNumber},${match.range().startColumn}`;
137
+ const getOtherLinePrefix = (i) => match.range().startLineNumber + i + '';
138
+ const fullMatchLines = match.fullPreviewLines();
139
+ const largestPrefixSize = fullMatchLines.reduce((largest, _, i) => {
140
+ const thisSize = i === 0 ?
141
+ getFirstLinePrefix().length :
142
+ getOtherLinePrefix(i).length;
143
+ return Math.max(thisSize, largest);
144
+ }, 0);
145
+ const formattedLines = ( fullMatchLines
146
+ .map((line, i) => {
147
+ const prefix = i === 0 ?
148
+ getFirstLinePrefix() :
149
+ getOtherLinePrefix(i);
150
+ const paddingStr = ' '.repeat(largestPrefixSize - prefix.length);
151
+ const indentStr = ' '.repeat(indent);
152
+ return `${indentStr}${prefix}: ${paddingStr}${line}`;
153
+ }));
154
+ return formattedLines.join('\n');
155
+ }
156
+ function fileFolderMatchToString(match, labelService) {
157
+ if (match instanceof FileMatch) {
158
+ return fileMatchToString(match, labelService);
159
+ }
160
+ else {
161
+ return folderMatchToString(match, labelService);
162
+ }
163
+ }
164
+ function fileMatchToString(fileMatch, labelService) {
165
+ const matchTextRows = ( fileMatch.matches()
166
+ .sort(searchMatchComparer)
167
+ .map(match => matchToString(match, 2)));
168
+ const uriString = labelService.getUriLabel(fileMatch.resource, { noPrefix: true });
169
+ return {
170
+ text: `${uriString}${lineDelimiter}${matchTextRows.join(lineDelimiter)}`,
171
+ count: matchTextRows.length
172
+ };
173
+ }
174
+ function folderMatchToString(folderMatch, labelService) {
175
+ const results = [];
176
+ let numMatches = 0;
177
+ const matches = folderMatch.matches().sort(searchMatchComparer);
178
+ matches.forEach(match => {
179
+ const result = fileFolderMatchToString(match, labelService);
180
+ numMatches += result.count;
181
+ results.push(result.text);
182
+ });
183
+ return {
184
+ text: results.join(lineDelimiter + lineDelimiter),
185
+ count: numMatches
186
+ };
187
+ }
188
+ function allFolderMatchesToString(folderMatches, labelService) {
189
+ const folderResults = [];
190
+ folderMatches = folderMatches.sort(searchMatchComparer);
191
+ for (let i = 0; i < folderMatches.length; i++) {
192
+ const folderResult = folderMatchToString(folderMatches[i], labelService);
193
+ if (folderResult.count) {
194
+ folderResults.push(folderResult.text);
195
+ }
196
+ }
197
+ return folderResults.join(lineDelimiter + lineDelimiter);
198
+ }
199
+ function getSelectedRow(accessor) {
200
+ const viewsService = accessor.get(IViewsService);
201
+ const searchView = getSearchView(viewsService);
202
+ return searchView?.getControl().getSelection()[0];
203
+ }
204
+ export { lineDelimiter };