Merge remote-tracking branch 'origin/master' into joao/linux-arm

This commit is contained in:
João Moreno 2020-09-09 08:53:49 +02:00
commit 6ca91db00a
No known key found for this signature in database
GPG key ID: 896B853774D1A575
230 changed files with 2733 additions and 1969 deletions

View file

@ -8,7 +8,7 @@
{
"kind": 2,
"language": "github-issues",
"value": "$repo=repo:microsoft/vscode\n$milestone=milestone:\"August 2020\"",
"value": "$repo=repo:microsoft/vscode\n$milestone=milestone:\"September 2020\"",
"editable": true
},
{

View file

@ -8,7 +8,7 @@
{
"kind": 2,
"language": "github-issues",
"value": "// list of repos we work in\n$repos=repo:microsoft/vscode repo:microsoft/vscode-remote-release repo:microsoft/vscode-js-debug repo:microsoft/vscode-pull-request-github repo:microsoft/vscode-github-issue-notebooks\n\n// current milestone name\n$milestone=milestone:\"August 2020\"",
"value": "// list of repos we work in\n$repos=repo:microsoft/vscode repo:microsoft/vscode-remote-release repo:microsoft/vscode-js-debug repo:microsoft/vscode-pull-request-github repo:microsoft/vscode-github-issue-notebooks\n\n// current milestone name\n$milestone=milestone:\"September 2020\"",
"editable": true
},
{

View file

@ -14,7 +14,7 @@
{
"kind": 2,
"language": "github-issues",
"value": "$repos=repo:microsoft/vscode repo:microsoft/vscode-internalbacklog repo:microsoft/vscode-remote-release repo:microsoft/vscode-js-debug repo:microsoft/vscode-pull-request-github repo:microsoft/vscode-github-issue-notebooks \n$milestone=milestone:\"July 2020\"",
"value": "$repos=repo:microsoft/vscode repo:microsoft/vscode-internalbacklog repo:microsoft/vscode-remote-release repo:microsoft/vscode-js-debug repo:microsoft/vscode-pull-request-github repo:microsoft/vscode-github-issue-notebooks \n$milestone=milestone:\"September 2020\"",
"editable": true
},
{

View file

@ -0,0 +1,483 @@
# Query: .innerHTML =
# Flags: CaseSensitive WordMatch
# Including: src/vs/**/*.{t,j}s
# Excluding: *.test.ts
# ContextLines: 3
57 results - 39 files
src/vs/base/browser/markdownRenderer.ts:
156 const strValue = values[0];
157 const span = element.querySelector(`div[data-code="${id}"]`);
158 if (span) {
159: span.innerHTML = strValue;
160 }
161 }).catch(err => {
162 // ignore
238 return true;
239 }
240
241: element.innerHTML = insane(renderedMarkdown, {
242 allowedSchemes,
243 // allowedTags should included everything that markdown renders to.
244 // Since we have our own sanitize function for marked, it's possible we missed some tag so let insane make sure.
src/vs/base/browser/ui/codicons/codiconStyles.ts:
20 for (let c of iconRegistry.all) {
21 rules.push(formatRule(c));
22 }
23: codiconStyleSheet.innerHTML = rules.join('\n');
24 }
25
26 const delayer = new RunOnceScheduler(updateAll, 0);
src/vs/base/browser/ui/contextview/contextview.ts:
157 this.shadowRootHostElement = DOM.$('.shadow-root-host');
158 this.container.appendChild(this.shadowRootHostElement);
159 this.shadowRoot = this.shadowRootHostElement.attachShadow({ mode: 'open' });
160: this.shadowRoot.innerHTML = `
161 <style>
162 ${SHADOW_ROOT_CSS}
163 </style>
src/vs/base/browser/ui/list/listWidget.ts:
826
827 const newStyles = content.join('\n');
828 if (newStyles !== this.styleElement.innerHTML) {
829: this.styleElement.innerHTML = newStyles;
830 }
831 }
832 }
src/vs/base/browser/ui/menu/menu.ts:
229 private initializeStyleSheet(container: HTMLElement): void {
230 if (isInShadowDOM(container)) {
231 this.styleSheet = createStyleSheet(container);
232: this.styleSheet.innerHTML = MENU_WIDGET_CSS;
233 } else {
234 if (!Menu.globalStyleSheet) {
235 Menu.globalStyleSheet = createStyleSheet();
236: Menu.globalStyleSheet.innerHTML = MENU_WIDGET_CSS;
237 }
238
239 this.styleSheet = Menu.globalStyleSheet;
src/vs/base/browser/ui/menu/menubar.ts:
548 }
549
550 innerHtml = innerHtml.replace(/&amp;&amp;/g, '&amp;');
551: titleElement.innerHTML = innerHtml;
552 } else {
553: titleElement.innerHTML = cleanMenuLabel.replace(/&&/g, '&');
554 }
555
556 let mnemonicMatches = MENU_MNEMONIC_REGEX.exec(label);
src/vs/base/browser/ui/sash/sash.ts:
266 }
267 }
268
269: style.innerHTML = `* { cursor: ${cursor} !important; }`;
270 };
271
272 const disposables = new DisposableStore();
src/vs/base/browser/ui/selectBox/selectBoxCustom.ts:
367 content.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.option-disabled:hover { outline: none !important; }`);
368 }
369
370: this.styleElement.innerHTML = content.join('\n');
371
372 this.applyStyles();
373 }
705 });
706
707
708: container.innerHTML = this.options[longest].text + (!!this.options[longest].decoratorRight ? (this.options[longest].decoratorRight + ' ') : '');
709 elementWidth = dom.getTotalWidth(container);
710 }
711
src/vs/base/browser/ui/tree/abstractTree.ts:
1476
1477 const newStyles = content.join('\n');
1478 if (newStyles !== this.styleElement.innerHTML) {
1479: this.styleElement.innerHTML = newStyles;
1480 }
1481
1482 this.view.style(styles);
src/vs/base/parts/quickinput/browser/quickInput.ts:
1693 }
1694 const newStyles = content.join('\n');
1695 if (newStyles !== this.ui.styleSheet.innerHTML) {
1696: this.ui.styleSheet.innerHTML = newStyles;
1697 }
1698 }
1699 }
src/vs/code/electron-browser/workbench/workbench.js:
124 const style = document.createElement('style');
125 style.className = 'initialShellColors';
126 document.head.appendChild(style);
127: style.innerHTML = `body { background-color: ${shellBackground}; color: ${shellForeground}; margin: 0; padding: 0; }`;
128
129 if (data && data.layoutInfo) {
130 // restore parts if possible (we might not always store layout info)
150
151 if (configuration.folderUri || configuration.workspace) {
152 // folder or workspace -> status bar color, sidebar
153: splash.innerHTML = `
154 <div style="position: absolute; width: 100%; left: 0; top: 0; height: ${layoutInfo.titleBarHeight}px; background-color: ${colorInfo.titleBarBackground}; -webkit-app-region: drag;"></div>
155 <div style="position: absolute; height: calc(100% - ${layoutInfo.titleBarHeight}px); top: ${layoutInfo.titleBarHeight}px; ${layoutInfo.sideBarSide}: 0; width: ${layoutInfo.activityBarWidth}px; background-color: ${colorInfo.activityBarBackground};"></div>
156 <div style="position: absolute; height: calc(100% - ${layoutInfo.titleBarHeight}px); top: ${layoutInfo.titleBarHeight}px; ${layoutInfo.sideBarSide}: ${layoutInfo.activityBarWidth}px; width: ${layoutInfo.sideBarWidth}px; background-color: ${colorInfo.sideBarBackground};"></div>
158 `;
159 } else {
160 // empty -> speical status bar color, no sidebar
161: splash.innerHTML = `
162 <div style="position: absolute; width: 100%; left: 0; top: 0; height: ${layoutInfo.titleBarHeight}px; background-color: ${colorInfo.titleBarBackground}; -webkit-app-region: drag;"></div>
163 <div style="position: absolute; height: calc(100% - ${layoutInfo.titleBarHeight}px); top: ${layoutInfo.titleBarHeight}px; ${layoutInfo.sideBarSide}: 0; width: ${layoutInfo.activityBarWidth}px; background-color: ${colorInfo.activityBarBackground};"></div>
164 <div style="position: absolute; width: 100%; bottom: 0; left: 0; height: ${layoutInfo.statusBarHeight}px; background-color: ${colorInfo.statusBarNoFolderBackground};"></div>
src/vs/code/electron-sandbox/issue/issueReporterMain.ts:
57 const platformClass = platform.isWindows ? 'windows' : platform.isLinux ? 'linux' : 'mac';
58 addClass(document.body, platformClass); // used by our fonts
59
60: document.body.innerHTML = BaseHtml();
61 const issueReporter = new IssueReporter(configuration);
62 issueReporter.render();
63 document.body.style.display = 'block';
244 content.push(`.monaco-text-button:not(.disabled):hover, .monaco-text-button:focus { background-color: ${styles.buttonHoverBackground} !important; }`);
245 }
246
247: styleTag.innerHTML = content.join('\n');
248 document.head.appendChild(styleTag);
249 document.body.style.color = styles.color || '';
250 }
src/vs/code/electron-sandbox/processExplorer/processExplorerMain.ts:
282 this.listeners.clear();
283
284 const tableHead = document.createElement('thead');
285: tableHead.innerHTML = `<tr>
286 <th scope="col" class="cpu">${localize('cpu', "CPU %")}</th>
287 <th scope="col" class="memory">${localize('memory', "Memory (MB)")}</th>
288 <th scope="col" class="pid">${localize('pid', "PID")}</th>
319 content.push(`.highest { color: ${styles.highlightForeground}; }`);
320 }
321
322: styleTag.innerHTML = content.join('\n');
323 if (document.head) {
324 document.head.appendChild(styleTag);
325 }
src/vs/editor/browser/view/domLineBreaksComputer.ts:
107 allCharOffsets[i] = tmp[0];
108 allVisibleColumns[i] = tmp[1];
109 }
110: containerDomNode.innerHTML = sb.build();
111
112 containerDomNode.style.position = 'absolute';
113 containerDomNode.style.top = '10000';
src/vs/editor/browser/view/viewLayer.ts:
507 private _finishRenderingNewLines(ctx: IRendererContext<T>, domNodeIsEmpty: boolean, newLinesHTML: string, wasNew: boolean[]): void {
508 const lastChild = <HTMLElement>this.domNode.lastChild;
509 if (domNodeIsEmpty || !lastChild) {
510: this.domNode.innerHTML = newLinesHTML;
511 } else {
512 lastChild.insertAdjacentHTML('afterend', newLinesHTML);
513 }
525 private _finishRenderingInvalidLines(ctx: IRendererContext<T>, invalidLinesHTML: string, wasInvalid: boolean[]): void {
526 const hugeDomNode = document.createElement('div');
527
528: hugeDomNode.innerHTML = invalidLinesHTML;
529
530 for (let i = 0; i < ctx.linesLength; i++) {
531 const line = ctx.lines[i];
src/vs/editor/browser/widget/diffEditorWidget.ts:
2157
2158 let domNode = document.createElement('div');
2159 domNode.className = `view-lines line-delete ${MOUSE_CURSOR_TEXT_CSS_CLASS_NAME}`;
2160: domNode.innerHTML = sb.build();
2161 Configuration.applyFontInfoSlow(domNode, fontInfo);
2162
2163 let marginDomNode = document.createElement('div');
2164 marginDomNode.className = 'inline-deleted-margin-view-zone';
2165: marginDomNode.innerHTML = marginHTML.join('');
2166 Configuration.applyFontInfoSlow(marginDomNode, fontInfo);
2167
2168 return {
src/vs/editor/standalone/browser/colorizer.ts:
40 let text = domNode.firstChild ? domNode.firstChild.nodeValue : '';
41 domNode.className += ' ' + theme;
42 let render = (str: string) => {
43: domNode.innerHTML = str;
44 };
45 return this.colorize(modeService, text || '', mimeType, options).then(render, (err) => console.error(err));
46 }
src/vs/editor/standalone/browser/standaloneThemeServiceImpl.ts:
211 if (!this._globalStyleElement) {
212 this._globalStyleElement = dom.createStyleSheet();
213 this._globalStyleElement.className = 'monaco-colors';
214: this._globalStyleElement.innerHTML = this._css;
215 this._styleElements.push(this._globalStyleElement);
216 }
217 return Disposable.None;
220 private _registerShadowDomContainer(domNode: HTMLElement): IDisposable {
221 const styleElement = dom.createStyleSheet(domNode);
222 styleElement.className = 'monaco-colors';
223: styleElement.innerHTML = this._css;
224 this._styleElements.push(styleElement);
225 return {
226 dispose: () => {
290 ruleCollector.addRule(generateTokensCSSForColorMap(colorMap));
291
292 this._css = cssRules.join('\n');
293: this._styleElements.forEach(styleElement => styleElement.innerHTML = this._css);
294
295 TokenizationRegistry.setColorMap(colorMap);
296 this._onColorThemeChange.fire(theme);
src/vs/editor/test/browser/controller/imeTester.ts:
55 let content = this._model.getModelLineContent(i);
56 r += content + '<br/>';
57 }
58: output.innerHTML = r;
59 }
60 }
61
69 let title = document.createElement('div');
70 title.className = 'title';
71
72: title.innerHTML = description + '. Type <strong>' + inputStr + '</strong>';
73 container.appendChild(title);
74
75 let startBtn = document.createElement('button');
src/vs/workbench/browser/parts/compositePart.ts:
414 const $this = this;
415 return {
416 updateTitle: (id, title, keybinding) => {
417: titleLabel.innerHTML = strings.escape(title);
418 titleLabel.title = keybinding ? nls.localize('titleTooltip', "{0} ({1})", title, keybinding) : title;
419 },
420
src/vs/workbench/browser/parts/statusbar/statusbarPart.ts:
672 this.styleElement = createStyleSheet(container);
673 }
674
675: this.styleElement.innerHTML = `.monaco-workbench .part.statusbar > .items-container > .statusbar-item.has-beak:before { border-bottom-color: ${backgroundColor}; }`;
676 }
677
678 private doCreateStatusItem(id: string, alignment: StatusbarAlignment, ...extraClasses: string[]): HTMLElement {
src/vs/workbench/contrib/comments/browser/commentsView.ts:
109 content.push(`.comments-panel .comments-panel-container .text code { color: ${codeTextForegroundColor}; }`);
110 }
111
112: styleElement.innerHTML = content.join('\n');
113 }
114
115 private async renderComments(): Promise<void> {
src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts:
692 }
693
694 if (label) {
695: this._headingLabel.innerHTML = strings.escape(label);
696 this._headingLabel.setAttribute('aria-label', label);
697 }
698 }
916 font-weight: ${fontInfo.fontWeight};
917 }`);
918
919: this._styleElement.innerHTML = content.join('\n');
920
921 // Editor decorations should also be responsive to theme changes
922 this.setCommentEditorDecorations();
src/vs/workbench/contrib/debug/browser/repl.ts:
306 const replInputLineHeight = this.replInput.getOption(EditorOption.lineHeight);
307
308 // Set the font size, font family, line height and align the twistie to be centered, and input theme color
309: this.styleElement.innerHTML = `
310 .repl .repl-tree .expression {
311 font-size: ${fontSize}px;
312 font-family: ${fontFamily};
src/vs/workbench/contrib/debug/browser/statusbarColorProvider.ts:
84 this.styleElement = createStyleSheet(container);
85 }
86
87: this.styleElement.innerHTML = `.monaco-workbench .part.statusbar > .items-container > .statusbar-item.has-beak:before { border-bottom-color: ${backgroundColor} !important; }`;
88 }
89
90 private getColorKey(noFolderColor: string, debuggingColor: string, normalColor: string): string {
src/vs/workbench/contrib/files/browser/views/explorerView.ts:
812
813 const newStyles = content.join('\n');
814 if (newStyles !== this.styleElement.innerHTML) {
815: this.styleElement.innerHTML = newStyles;
816 }
817 }
818
src/vs/workbench/contrib/notebook/browser/diff/notebookTextDiffList.ts:
222
223 const newStyles = content.join('\n');
224 if (newStyles !== this.styleElement.innerHTML) {
225: this.styleElement.innerHTML = newStyles;
226 }
227 }
228 }
src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts:
1033
1034 const newStyles = content.join('\n');
1035 if (newStyles !== this.styleElement.innerHTML) {
1036: this.styleElement.innerHTML = newStyles;
1037 }
1038 }
1039
src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts:
443
444 private getMarkdownDragImage(templateData: MarkdownCellRenderTemplate): HTMLElement {
445 const dragImageContainer = DOM.$('.cell-drag-image.monaco-list-row.focused.markdown-cell-row');
446: dragImageContainer.innerHTML = templateData.container.outerHTML;
447
448 // Remove all rendered content nodes after the
449 const markdownContent = dragImageContainer.querySelector('.cell.markdown')!;
587
588 private getDragImageImpl(templateData: BaseCellRenderTemplate, editor: ICodeEditor, type: 'code' | 'markdown'): HTMLElement | null {
589 const dragImageContainer = DOM.$(`.cell-drag-image.monaco-list-row.focused.${type}-cell-row`);
590: dragImageContainer.innerHTML = templateData.container.innerHTML;
591
592 const editorContainer = dragImageContainer.querySelector('.cell-editor-container');
593 if (!editorContainer) {
599 return null;
600 }
601
602: editorContainer.innerHTML = richEditorText;
603
604 return dragImageContainer;
605 }
src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts:
375 addMouseoverListeners(outputNode, outputId);
376 const content = data.content;
377 if (content.type === RenderOutputType.Html) {
378: outputNode.innerHTML = content.htmlContent;
379 cellOutputContainer.appendChild(outputNode);
380 domEval(outputNode);
381 } else {
src/vs/workbench/contrib/sash/browser/sash.ts:
35 const size = clamp(this.configurationService.getValue<number>(this.configurationName) ?? minSize, minSize, maxSize);
36
37 // Update styles
38: this.stylesheet.innerHTML = `
39 .monaco-sash.vertical { cursor: ew-resize; top: 0; width: ${size}px; height: 100%; }
40 .monaco-sash.horizontal { cursor: ns-resize; left: 0; width: 100%; height: ${size}px; }
41 .monaco-sash:not(.disabled).orthogonal-start::before, .monaco-sash:not(.disabled).orthogonal-end::after { content: ' '; height: ${size * 2}px; width: ${size * 2}px; z-index: 100; display: block; cursor: all-scroll; position: absolute; }
src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts:
1301
1302 private setViewState(state: IViewState): void {
1303 this.viewState = state;
1304: this.stylesheet.innerHTML = `
1305 .monaco-editor .dirty-diff-modified,.monaco-editor .dirty-diff-added{border-left-width:${state.width}px;}
1306 .monaco-editor .dirty-diff-modified, .monaco-editor .dirty-diff-added, .monaco-editor .dirty-diff-deleted {
1307 opacity: ${state.visibility === 'always' ? 1 : 0};
src/vs/workbench/contrib/watermark/browser/watermark.ts:
141 const dd = dom.append(dl, $('dd'));
142 const keybinding = new KeybindingLabel(dd, OS, { renderUnboundKeybindings: true });
143 keybinding.set(this.keybindingService.lookupKeybinding(entry.id));
144: dd.innerHTML = keybinding.element.outerHTML;
145 });
146 };
147
src/vs/workbench/contrib/webview/browser/webviewIconManager.ts:
61 }
62 }
63 }
64: this._styleElement.innerHTML = cssRules.join('\n');
65 }
66 }
src/vs/workbench/contrib/webview/browser/pre/main.js:
386 // apply default styles
387 const defaultStyles = newDocument.createElement('style');
388 defaultStyles.id = '_defaultStyles';
389: defaultStyles.innerHTML = defaultCssRules;
390 newDocument.head.prepend(defaultStyles);
391
392 applyStyles(newDocument, newDocument.body);
src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts:
328
329 const prodName = container.querySelector('.welcomePage .title .caption') as HTMLElement;
330 if (prodName) {
331: prodName.innerHTML = this.productService.nameLong;
332 }
333
334 recentlyOpened.then(({ workspaces }) => {
src/vs/workbench/contrib/welcome/walkThrough/browser/walkThroughPart.ts:
281
282 const content = model.main.textEditorModel.getValue(EndOfLinePreference.LF);
283 if (!strings.endsWith(input.resource.path, '.md')) {
284: this.content.innerHTML = content;
285 this.updateSizeClasses();
286 this.decorateContent();
287 this.contentDisposables.push(this.keybindingService.onDidUpdateKeybindings(() => this.decorateContent()));
303 const innerContent = document.createElement('div');
304 innerContent.classList.add('walkThroughContent'); // only for markdown files
305 const markdown = this.expandMacros(content);
306: innerContent.innerHTML = marked(markdown, { renderer });
307 this.content.appendChild(innerContent);
308
309 model.snippets.forEach((snippet, i) => {
src/vs/workbench/services/textMate/browser/abstractTextMateService.ts:
312 grammarFactory.setTheme(theme, tokenColorMap);
313 let colorMap = AbstractTextMateService._toColorMap(tokenColorMap);
314 let cssRules = generateTokensCSSForColorMap(colorMap);
315: this._styleElement.innerHTML = cssRules;
316 TokenizationRegistry.setColorMap(colorMap);
317 }
318
src/vs/workbench/services/themes/browser/workbenchThemeService.ts:
692 const elStyle = document.createElement('style');
693 elStyle.type = 'text/css';
694 elStyle.className = rulesClassName;
695: elStyle.innerHTML = styleSheetContent;
696 document.head.appendChild(elStyle);
697 } else {
698: (<HTMLStyleElement>themeStyles[0]).innerHTML = styleSheetContent;
699 }
700 }
701

View file

@ -1,3 +1,3 @@
disturl "https://atom.io/download/electron"
target "9.2.1"
target "9.3.0"
runtime "electron"

View file

@ -41,7 +41,7 @@ exports.config = {
darwinBundleDocumentType(["bowerrc"], 'resources/darwin/bower.icns'),
darwinBundleDocumentType(["c", "h"], 'resources/darwin/c.icns'),
darwinBundleDocumentType(["config", "editorconfig", "gitattributes", "gitconfig", "gitignore", "ini"], 'resources/darwin/config.icns'),
darwinBundleDocumentType(["cc", "cpp", "cxx", "hh", "hpp", "hxx"], 'resources/darwin/cpp.icns'),
darwinBundleDocumentType(["cc", "cpp", "cxx", "c++", "hh", "hpp", "hxx", "h++"], 'resources/darwin/cpp.icns'),
darwinBundleDocumentType(["cs", "csx"], 'resources/darwin/csharp.icns'),
darwinBundleDocumentType(["css"], 'resources/darwin/css.icns'),
darwinBundleDocumentType(["go"], 'resources/darwin/go.icns'),

View file

@ -46,7 +46,7 @@ export const config = {
darwinBundleDocumentType(["bowerrc"], 'resources/darwin/bower.icns'),
darwinBundleDocumentType(["c", "h"], 'resources/darwin/c.icns'),
darwinBundleDocumentType(["config", "editorconfig", "gitattributes", "gitconfig", "gitignore", "ini"], 'resources/darwin/config.icns'),
darwinBundleDocumentType(["cc", "cpp", "cxx", "hh", "hpp", "hxx"], 'resources/darwin/cpp.icns'),
darwinBundleDocumentType(["cc", "cpp", "cxx", "c++", "hh", "hpp", "hxx", "h++"], 'resources/darwin/cpp.icns'),
darwinBundleDocumentType(["cs", "csx"], 'resources/darwin/csharp.icns'),
darwinBundleDocumentType(["css"], 'resources/darwin/css.icns'),
darwinBundleDocumentType(["go"], 'resources/darwin/go.icns'),

View file

@ -173,6 +173,13 @@ Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\{#RegValueName}.bower
Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\{#RegValueName}.bowerrc\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\resources\app\resources\win32\bower.ico"; Tasks: associatewithfiles
Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\{#RegValueName}.bowerrc\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#ExeBasename}.exe"" ""%1"""; Tasks: associatewithfiles
Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\.c++\OpenWithProgids"; ValueType: none; ValueName: "{#RegValueName}"; Flags: deletevalue uninsdeletevalue; Tasks: associatewithfiles
Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\.c++\OpenWithProgids"; ValueType: string; ValueName: "{#RegValueName}.c++"; ValueData: ""; Flags: uninsdeletevalue; Tasks: associatewithfiles
Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\{#RegValueName}.c++"; ValueType: string; ValueName: ""; ValueData: "{cm:SourceFile,C++}"; Flags: uninsdeletekey; Tasks: associatewithfiles
Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\{#RegValueName}.c++"; ValueType: string; ValueName: "AppUserModelID"; ValueData: "{#AppUserId}"; Flags: uninsdeletekey; Tasks: associatewithfiles
Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\{#RegValueName}.c++\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\resources\app\resources\win32\cpp.ico"; Tasks: associatewithfiles
Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\{#RegValueName}.c++\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#ExeBasename}.exe"" ""%1"""; Tasks: associatewithfiles
Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\.c\OpenWithProgids"; ValueType: none; ValueName: "{#RegValueName}"; Flags: deletevalue uninsdeletevalue; Tasks: associatewithfiles
Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\.c\OpenWithProgids"; ValueType: string; ValueName: "{#RegValueName}.c"; ValueData: ""; Flags: uninsdeletevalue; Tasks: associatewithfiles
Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\{#RegValueName}.c"; ValueType: string; ValueName: ""; ValueData: "{cm:SourceFile,C}"; Flags: uninsdeletekey; Tasks: associatewithfiles
@ -442,6 +449,13 @@ Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\{#RegValueName}.hbs";
Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\{#RegValueName}.hbs\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\resources\app\resources\win32\default.ico"; Tasks: associatewithfiles
Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\{#RegValueName}.hbs\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#ExeBasename}.exe"" ""%1"""; Tasks: associatewithfiles
Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\.h++\OpenWithProgids"; ValueType: none; ValueName: "{#RegValueName}"; Flags: deletevalue uninsdeletevalue; Tasks: associatewithfiles
Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\.h++\OpenWithProgids"; ValueType: string; ValueName: "{#RegValueName}.h++"; ValueData: ""; Flags: uninsdeletevalue; Tasks: associatewithfiles
Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\{#RegValueName}.h++"; ValueType: string; ValueName: ""; ValueData: "{cm:SourceFile,C++ Header}"; Flags: uninsdeletekey; Tasks: associatewithfiles
Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\{#RegValueName}.h++"; ValueType: string; ValueName: "AppUserModelID"; ValueData: "{#AppUserId}"; Flags: uninsdeletekey; Tasks: associatewithfiles
Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\{#RegValueName}.h++\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\resources\app\resources\win32\cpp.ico"; Tasks: associatewithfiles
Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\{#RegValueName}.h++\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#ExeBasename}.exe"" ""%1"""; Tasks: associatewithfiles
Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\.hh\OpenWithProgids"; ValueType: none; ValueName: "{#RegValueName}"; Flags: deletevalue uninsdeletevalue; Tasks: associatewithfiles
Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\.hh\OpenWithProgids"; ValueType: string; ValueName: "{#RegValueName}.hh"; ValueData: ""; Flags: uninsdeletevalue; Tasks: associatewithfiles
Root: {#SoftwareClassesRootKey}; Subkey: "Software\Classes\{#RegValueName}.hh"; ValueType: string; ValueName: ""; ValueData: "{cm:SourceFile,C++ Header}"; Flags: uninsdeletekey; Tasks: associatewithfiles

View file

@ -60,12 +60,12 @@
"git": {
"name": "electron",
"repositoryUrl": "https://github.com/electron/electron",
"commitHash": "03c7a54dc534ce1867d4393b9b1a6989d4a7e005"
"commitHash": "fb03807cd21915ddc3aa2521ba4f5ba14597bd7e"
}
},
"isOnlyProductionDependency": true,
"license": "MIT",
"version": "9.2.1"
"version": "9.3.0"
},
{
"component": {

View file

@ -1,6 +1,6 @@
{
"comments": {
"lineComment": "REM"
"lineComment": "@REM"
},
"brackets": [
["{", "}"],
@ -22,8 +22,8 @@
],
"folding": {
"markers": {
"start": "^\\s*(::\\s*|REM\\s+)#region",
"end": "^\\s*(::\\s*|REM\\s+)#endregion"
"start": "^\\s*(::|REM|@REM)\\s*#region",
"end": "^\\s*(::|REM|@REM)\\s*#endregion"
}
}
}

View file

@ -50,6 +50,7 @@
"type": "string",
"enum": [
"none",
"loginShell",
"loginInteractiveShell",
"interactiveShell"
],

View file

@ -96,6 +96,7 @@
"type": "string",
"enum": [
"none",
"loginShell",
"loginInteractiveShell",
"interactiveShell"
],

View file

@ -34,8 +34,8 @@
".c++",
".hpp",
".hh",
".hxx",
".h++",
".hxx",
".h++",
".h",
".ii",
".ino",

View file

@ -146,18 +146,13 @@ class ServerReadyDetector extends vscode.Disposable {
break;
case 'debugWithChrome':
if (vscode.env.remoteName === 'wsl' || !!vscode.extensions.getExtension('msjsdiag.debugger-for-chrome')) {
vscode.debug.startDebugging(session.workspaceFolder, {
type: 'chrome',
name: 'Chrome Debug',
request: 'launch',
url: uri,
webRoot: args.webRoot || WEB_ROOT
}, session);
} else {
const errMsg = localize('server.ready.chrome.not.installed', "The action '{0}' requires the '{1}' extension.", 'debugWithChrome', 'Debugger for Chrome');
vscode.window.showErrorMessage(errMsg, { modal: true }).then(_ => undefined);
}
vscode.debug.startDebugging(session.workspaceFolder, {
type: 'pwa-chrome',
name: 'Chrome Debug',
request: 'launch',
url: uri,
webRoot: args.webRoot || WEB_ROOT
});
break;
default:

View file

@ -166,8 +166,8 @@
"view.workbench.scm.missing": "A valid git installation was not detected, more details can be found in the [git output](command:git.showOutput).\nPlease [install git](https://git-scm.com/), or learn more about how to use git and source control in VS Code in [our docs](https://aka.ms/vscode-scm).\nIf you're using a different version control system, you can [search the Marketplace](command:workbench.extensions.search?%22%40category%3A%5C%22scm%20providers%5C%22%22) for additional extensions.",
"view.workbench.scm.disabled": "If you would like to use git features, please enable git in your [settings](command:workbench.action.openSettings?%5B%22git.enabled%22%5D).\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).",
"view.workbench.scm.empty": "In order to use git features, you can open a folder containing a git repository or clone from a URL.\n[Open Folder](command:vscode.openFolder)\n[Clone Repository](command:git.clone)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).",
"view.workbench.scm.folder": "The folder currently open doesn't have a git repository.\n[Initialize Repository](command:git.init?%5Btrue%5D)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).",
"view.workbench.scm.workspace": "The workspace currently open doesn't have any folders containing git repositories.\n[Initialize Repository](command:git.init)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).",
"view.workbench.scm.folder": "The folder currently open doesn't have a git repository. You can initialize a repository which will enable source control features powered by git.\n[Initialize Repository](command:git.init?%5Btrue%5D)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).",
"view.workbench.scm.workspace": "The workspace currently open doesn't have any folders containing git repositories. You can initialize a repository on a folder which will enable source control features powered by git.\n[Initialize Repository](command:git.init)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).",
"view.workbench.scm.emptyWorkspace": "The workspace currently open doesn't have any folders containing git repositories.\n[Add Folder to Workspace](command:workbench.action.addRootFolder)\nTo learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).",
"view.workbench.cloneRepository": "You can also clone a repository from a URL. To learn more about how to use git and source control in VS Code [read our docs](https://aka.ms/vscode-scm).\n[Clone Repository](command:git.clone)"
}

View file

@ -2,6 +2,6 @@
"displayName": "GitHub",
"description": "GitHub",
"config.gitAuthentication": "Controls whether to enable automatic GitHub authentication for git commands within VS Code.",
"welcome.publishFolder": "You can also directly publish this folder to a GitHub repository.\n[$(github) Publish to GitHub](command:github.publish)",
"welcome.publishWorkspaceFolder": "You can also directly publish a workspace folder to a GitHub repository.\n[$(github) Publish to GitHub](command:github.publish)"
"welcome.publishFolder": "You can also directly publish this folder to a GitHub repository. Once published, you'll have access to source control features powered by git and GitHub.\n[$(github) Publish to GitHub](command:github.publish)",
"welcome.publishWorkspaceFolder": "You can also directly publish a workspace folder to a GitHub repository. Once published, you'll have access to source control features powered by git and GitHub.\n[$(github) Publish to GitHub](command:github.publish)"
}

View file

@ -13,7 +13,7 @@
"languages": [{
"id": "groovy",
"aliases": ["Groovy", "groovy"],
"extensions": [".groovy", ".gvy", ".gradle", ".jenkinsfile"],
"extensions": [".groovy", ".gvy", ".gradle", ".jenkinsfile", ".nf"],
"filenamePatterns": ["Jenkinsfile.*"],
"firstLine": "^#!.*\\bgroovy\\b",
"configuration": "./language-configuration.json"

View file

@ -6,11 +6,11 @@
"git": {
"name": "atom/language-java",
"repositoryUrl": "https://github.com/atom/language-java",
"commitHash": "2e179ceac423403eb5bf0eff26884093c3edba6f"
"commitHash": "f631536a4137d65b622f01cebeac72345f9e6f70"
}
},
"license": "MIT",
"version": "0.31.4"
"version": "0.31.5"
}
],
"version": 1

View file

@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
"version": "https://github.com/atom/language-java/commit/2e179ceac423403eb5bf0eff26884093c3edba6f",
"version": "https://github.com/atom/language-java/commit/f631536a4137d65b622f01cebeac72345f9e6f70",
"name": "Java",
"scopeName": "source.java",
"patterns": [
@ -1785,7 +1785,7 @@
]
},
"variables": {
"begin": "(?x)\n(?=\n (\n \\b(void|boolean|byte|char|short|int|float|long|double)\\b\n |\n (?>(\\w+\\.)*[A-Z_]+\\w*) # e.g. `javax.ws.rs.Response`, or `String`\n )\n \\s*\n (\n <[\\w<>,\\.?\\s\\[\\]]*> # e.g. `HashMap<Integer, String>`, or `List<java.lang.String>`\n )?\n \\s*\n (\n (\\[\\])* # int[][]\n )?\n \\s+\n [A-Za-z_$][\\w$]* # At least one identifier after space\n ([\\w\\[\\],$][\\w\\[\\],\\s]*)? # possibly primitive array or additional identifiers\n \\s*(=|:|;)\n)",
"begin": "(?x)\n(?=\n \\b\n (\n (void|boolean|byte|char|short|int|float|long|double)\n |\n (?>(\\w+\\.)*[A-Z_]+\\w*) # e.g. `javax.ws.rs.Response`, or `String`\n )\n \\b\n \\s*\n (\n <[\\w<>,\\.?\\s\\[\\]]*> # e.g. `HashMap<Integer, String>`, or `List<java.lang.String>`\n )?\n \\s*\n (\n (\\[\\])* # int[][]\n )?\n \\s+\n [A-Za-z_$][\\w$]* # At least one identifier after space\n ([\\w\\[\\],$][\\w\\[\\],\\s]*)? # possibly primitive array or additional identifiers\n \\s*(=|:|;)\n)",
"end": "(?=\\=|:|;)",
"name": "meta.definition.variable.java",
"patterns": [

View file

@ -6,7 +6,7 @@
"git": {
"name": "language-php",
"repositoryUrl": "https://github.com/atom/language-php",
"commitHash": "11cdaf62a9d949d3aca550f1a58c9754de6b5ab0"
"commitHash": "6c0da475f86b45ea990638525f68be7658986546"
}
},
"license": "MIT",

View file

@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
"version": "https://github.com/atom/language-php/commit/11cdaf62a9d949d3aca550f1a58c9754de6b5ab0",
"version": "https://github.com/atom/language-php/commit/6c0da475f86b45ea990638525f68be7658986546",
"scopeName": "source.php",
"patterns": [
{
@ -1329,6 +1329,17 @@
}
]
},
"named-arguments": {
"match": "(?i)(?<=^|\\(|,)\\s*([a-z_\\x{7f}-\\x{7fffffff}][a-z0-9_\\x{7f}-\\x{7fffffff}]*)\\s*(:)(?!:)",
"captures": {
"1": {
"name": "entity.name.variable.parameter.php"
},
"2": {
"name": "punctuation.separator.colon.php"
}
}
},
"function-call": {
"patterns": [
{
@ -1357,6 +1368,9 @@
},
"name": "meta.function-call.php",
"patterns": [
{
"include": "#named-arguments"
},
{
"include": "$self"
}
@ -1395,6 +1409,9 @@
},
"name": "meta.function-call.php",
"patterns": [
{
"include": "#named-arguments"
},
{
"include": "$self"
}
@ -2242,6 +2259,9 @@
},
"name": "meta.method-call.php",
"patterns": [
{
"include": "#named-arguments"
},
{
"include": "$self"
}
@ -2614,6 +2634,9 @@
},
"name": "meta.method-call.static.php",
"patterns": [
{
"include": "#named-arguments"
},
{
"include": "$self"
}
@ -3447,6 +3470,18 @@
}
},
"patterns": [
{
"match": "(?i)^\\s*([a-z_\\x{7f}-\\x{7fffffff}][a-z0-9_\\x{7f}-\\x{7fffffff}]*)\\s*(?=:(?!:))",
"captures": {
"1": {
"patterns": [
{
"include": "$self"
}
]
}
}
},
{
"include": "$self"
}

View file

@ -15,7 +15,7 @@
"id": "python",
"extensions": [ ".py", ".rpy", ".pyw", ".cpy", ".gyp", ".gypi", ".pyi", ".ipy"],
"aliases": [ "Python", "py" ],
"filenames": [ "Snakefile" ],
"filenames": [ "Snakefile", "SConstruct", "SConscript" ],
"firstLine": "^#!\\s*/?.*\\bpython[0-9.-]*\\b",
"configuration": "./language-configuration.json"
}],

View file

@ -6,7 +6,7 @@
"git": {
"name": "Microsoft/vscode-mssql",
"repositoryUrl": "https://github.com/Microsoft/vscode-mssql",
"commitHash": "750d30dc48c4c0317b63bb5f1ed3e71487bb84a1"
"commitHash": "61ae0eb21ac53883a23e09913a5ae77a59126ff9"
}
},
"license": "MIT",

View file

@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
"version": "https://github.com/Microsoft/vscode-mssql/commit/750d30dc48c4c0317b63bb5f1ed3e71487bb84a1",
"version": "https://github.com/Microsoft/vscode-mssql/commit/61ae0eb21ac53883a23e09913a5ae77a59126ff9",
"name": "SQL",
"scopeName": "source.sql",
"patterns": [

View file

@ -306,7 +306,10 @@ class GetErrRequest {
public readonly files: ResourceMap<void>,
onDone: () => void
) {
const allFiles = coalesce(Array.from(files.entries).map(entry => client.normalizedPath(entry.resource)));
const allFiles = coalesce(Array.from(files.entries)
.filter(entry => client.hasCapabilityForResource(entry.resource, ClientCapability.Semantic))
.map(entry => client.normalizedPath(entry.resource)));
if (!allFiles.length || !client.capabilities.has(ClientCapability.Semantic)) {
this._done = true;
setImmediate(onDone);
@ -529,7 +532,7 @@ export default class BufferSyncSupport extends Disposable {
this.triggerDiagnostics();
}
public getErr(resources: vscode.Uri[]): any {
public getErr(resources: readonly vscode.Uri[]): any {
const handledResources = resources.filter(resource => this.handles(resource));
if (!handledResources.length) {
return;

View file

@ -5,7 +5,6 @@
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import * as path from 'path';
import { TypeScriptServiceConfiguration } from '../utils/configuration';
import { Disposable } from '../utils/dispose';
import { ITypeScriptVersionProvider, TypeScriptVersion } from './versionProvider';
@ -110,7 +109,7 @@ export class TypeScriptVersionManager extends Disposable {
run: async () => {
await this.workspaceState.update(useWorkspaceTsdkStorageKey, true);
const tsConfig = vscode.workspace.getConfiguration('typescript');
await tsConfig.update('tsdk', path.dirname(version.tsServerPath), false);
await tsConfig.update('tsdk', version.pathLabel, false);
this.updateActiveVersion(version);
},
};

View file

@ -104,7 +104,8 @@ export class DiskTypeScriptVersionProvider implements ITypeScriptVersionProvider
return [
new TypeScriptVersion(source,
serverPath,
DiskTypeScriptVersionProvider.getApiVersion(serverPath))
DiskTypeScriptVersionProvider.getApiVersion(serverPath),
tsdkPathSetting)
];
}

View file

@ -145,10 +145,15 @@ export interface ITypeScriptServiceClient {
/**
* Tries to ensure that a vscode document is open on the TS server.
*
* Returns the normalized path.
* @return The normalized path or `undefined` if the document is not open on the server.
*/
toOpenedFilePath(document: vscode.TextDocument): string | undefined;
/**
* Checks if `resource` has a given capability.
*/
hasCapabilityForResource(resource: vscode.Uri, capability: ClientCapability): boolean;
getWorkspaceRootForResource(resource: vscode.Uri): string | undefined;
readonly onTsServerStarted: vscode.Event<{ version: TypeScriptVersion, usedApiVersion: API }>;

View file

@ -673,6 +673,26 @@ export default class TypeScriptServiceClient extends Disposable implements IType
return this.toPath(document.uri) || undefined;
}
public hasCapabilityForResource(resource: vscode.Uri, capability: ClientCapability): boolean {
switch (capability) {
case ClientCapability.Semantic:
{
switch (resource.scheme) {
case fileSchemes.file:
case fileSchemes.untitled:
return true;
default:
return false;
}
}
case ClientCapability.Syntax:
case ClientCapability.EnhancedSyntax:
{
return true;
}
}
}
public toResource(filepath: string): vscode.Uri {
if (filepath.startsWith(this.inMemoryResourcePrefix)) {
const resource = vscode.Uri.parse(filepath.slice(1));

View file

@ -6,8 +6,6 @@
export const file = 'file';
export const untitled = 'untitled';
export const git = 'git';
export const pr = 'pr';
export const privateScheme = 'private';
/** Live share scheme */
export const vsls = 'vsls';
export const walkThroughSnippet = 'walkThroughSnippet';
@ -22,7 +20,5 @@ export const semanticSupportedSchemes = [
*/
export const disabledSchemes = new Set([
git,
vsls,
privateScheme,
pr,
vsls
]);

View file

@ -59,7 +59,7 @@
"native-is-elevated": "0.4.1",
"native-keymap": "2.2.0",
"native-watchdog": "1.3.0",
"node-pty": "0.10.0-beta8",
"node-pty": "0.10.0-beta17",
"semver-umd": "^5.5.7",
"spdlog": "^0.11.1",
"sudo-prompt": "9.1.1",
@ -68,13 +68,13 @@
"vscode-nsfw": "1.2.8",
"vscode-oniguruma": "1.3.1",
"vscode-proxy-agent": "^0.5.2",
"vscode-ripgrep": "^1.8.0",
"vscode-ripgrep": "^1.9.0",
"vscode-sqlite3": "4.0.10",
"vscode-textmate": "5.2.0",
"xterm": "4.9.0-beta.25",
"xterm": "4.9.0-beta.32",
"xterm-addon-search": "0.7.0",
"xterm-addon-unicode11": "0.2.0",
"xterm-addon-webgl": "0.9.0-beta.1",
"xterm-addon-webgl": "0.9.0-beta.4",
"yauzl": "^2.9.2",
"yazl": "^2.4.3"
},
@ -110,7 +110,7 @@
"css-loader": "^3.2.0",
"debounce": "^1.0.0",
"deemon": "^1.4.0",
"electron": "9.2.1",
"electron": "9.3.0",
"eslint": "6.8.0",
"eslint-plugin-jsdoc": "^19.1.0",
"event-stream": "3.3.4",

View file

@ -61,7 +61,7 @@
},
{
"name": "ms-vscode.references-view",
"version": "0.0.62",
"version": "0.0.63",
"repo": "https://github.com/Microsoft/vscode-reference-view",
"metadata": {
"id": "dc489f46-520d-4556-ae85-1f9eab3c412d",

View file

@ -12,18 +12,18 @@
"jschardet": "2.2.1",
"minimist": "^1.2.5",
"native-watchdog": "1.3.0",
"node-pty": "0.10.0-beta8",
"node-pty": "0.10.0-beta17",
"semver-umd": "^5.5.7",
"spdlog": "^0.11.1",
"vscode-nsfw": "1.2.8",
"vscode-oniguruma": "1.3.1",
"vscode-proxy-agent": "^0.5.2",
"vscode-ripgrep": "^1.8.0",
"vscode-ripgrep": "^1.9.0",
"vscode-textmate": "5.2.0",
"xterm": "4.9.0-beta.25",
"xterm": "4.9.0-beta.32",
"xterm-addon-search": "0.7.0",
"xterm-addon-unicode11": "0.2.0",
"xterm-addon-webgl": "0.9.0-beta.1",
"xterm-addon-webgl": "0.9.0-beta.4",
"yauzl": "^2.9.2",
"yazl": "^2.4.3"
},

View file

@ -7,9 +7,9 @@
"semver-umd": "^5.5.7",
"vscode-oniguruma": "1.3.1",
"vscode-textmate": "5.2.0",
"xterm": "4.9.0-beta.25",
"xterm": "4.9.0-beta.32",
"xterm-addon-search": "0.7.0",
"xterm-addon-unicode11": "0.2.0",
"xterm-addon-webgl": "0.9.0-beta.1"
"xterm-addon-webgl": "0.9.0-beta.4"
}
}

View file

@ -37,12 +37,12 @@ xterm-addon-unicode11@0.2.0:
resolved "https://registry.yarnpkg.com/xterm-addon-unicode11/-/xterm-addon-unicode11-0.2.0.tgz#9ed0c482b353908bba27778893ca80823382737c"
integrity sha512-rjFDItPc/IDoSiEnoDFwKroNwLD/7t9vYKENjrcKVZg5tgJuuUj8D4rZtP6iVCjSB1LTLYmUs4L/EmCqIyLR/Q==
xterm-addon-webgl@0.9.0-beta.1:
version "0.9.0-beta.1"
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.9.0-beta.1.tgz#e0a4e9b71db7ef8182064236844caf32833214c2"
integrity sha512-yyIYfehzaqaOTOTjSapA3sEcaGDIPn0xAiWyRIWyW5zwTZIo7FA+O4IzhgAT9b7ioJWLcPoHPUA0OFNHAx20vQ==
xterm-addon-webgl@0.9.0-beta.4:
version "0.9.0-beta.4"
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.9.0-beta.4.tgz#5f5fde50db5c06b116471bcf56ad9930884b36fa"
integrity sha512-GuCvF7Eg1nKLX6zUbJLkt5cqeeccUjf/G6fugCfrkR0EWWC6Ik5mEsEOs5UWm9vvY2kX9t16BdCrgqp8KJegEg==
xterm@4.9.0-beta.25:
version "4.9.0-beta.25"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.9.0-beta.25.tgz#c229a144184ab7b3c3afdaff76f9d81bac58933b"
integrity sha512-NJHwuS7Qsoq/Yuobl+Au4rgol/oBNj4pGoR2R6IRnXODS5RDE4spHDofWKiUkDMlNZtPPku1W7k1kFnonDIhhg==
xterm@4.9.0-beta.32:
version "4.9.0-beta.32"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.9.0-beta.32.tgz#d1243d3be211cc06aad3418e696e4eced995c20c"
integrity sha512-jloHNBnj6XRJt+oPkapvrXJZVsYq6se/PEgzErl0iZn9qzSB3jmWE4byumoEjXJR6EgU5ZOmNljeeEDA9jO/jA==

View file

@ -294,10 +294,10 @@ node-addon-api@1.6.2:
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-1.6.2.tgz#d8aad9781a5cfc4132cc2fecdbdd982534265217"
integrity sha512-479Bjw9nTE5DdBSZZWprFryHGjUaQC31y1wHo19We/k0BZlrmhqQitWoUL0cD8+scljCbIUL+E58oRDEakdGGA==
node-pty@0.10.0-beta8:
version "0.10.0-beta8"
resolved "https://registry.yarnpkg.com/node-pty/-/node-pty-0.10.0-beta8.tgz#f4aa56c71a794f4580373a3030dfebd25240c6db"
integrity sha512-Ul/hLsadC0SvvShxpne+kq2ebSMcitewlNhrwoXXBvFdCqxJt7Ai1AgMhH7AKBUp06uBeYXThJ2ihTszrkdnYw==
node-pty@0.10.0-beta17:
version "0.10.0-beta17"
resolved "https://registry.yarnpkg.com/node-pty/-/node-pty-0.10.0-beta17.tgz#962d4a3f4dc6772385e0cad529c209cef3bc79e6"
integrity sha512-tn7EANQacnAvnOQCImvgag1DL0tVmUoY/1yIZbh3u/BBpvCcGHLZJNn7TXheodRLr6hmGSUS2VbfcUr9p0gOug==
dependencies:
nan "^2.14.0"
@ -410,10 +410,10 @@ vscode-proxy-agent@^0.5.2:
https-proxy-agent "^2.2.3"
socks-proxy-agent "^4.0.1"
vscode-ripgrep@^1.8.0:
version "1.8.0"
resolved "https://registry.yarnpkg.com/vscode-ripgrep/-/vscode-ripgrep-1.8.0.tgz#dfe7c2ae2a2032df8a8108765c2feef73474888a"
integrity sha512-/Q5XtePkTLLi8yplr5ai24pVEymRF62xH9xXrtj35GTaDCJg3zq1s1/L1UqhVbfNDv4OcMBYjyIAt/quEi3d5w==
vscode-ripgrep@^1.9.0:
version "1.9.0"
resolved "https://registry.yarnpkg.com/vscode-ripgrep/-/vscode-ripgrep-1.9.0.tgz#d6cdea4d290f3c2919472cdcfe2440d5fb1f99db"
integrity sha512-7jyAC/NNfvMPZgCVkyqIn0STYJ7wIk3PF2qA2cX1sEutx1g/e2VtgKAodXnfpreJq4993JT/BSIigOv/0lBSzg==
dependencies:
https-proxy-agent "^4.0.0"
proxy-from-env "^1.1.0"
@ -445,15 +445,15 @@ xterm-addon-unicode11@0.2.0:
resolved "https://registry.yarnpkg.com/xterm-addon-unicode11/-/xterm-addon-unicode11-0.2.0.tgz#9ed0c482b353908bba27778893ca80823382737c"
integrity sha512-rjFDItPc/IDoSiEnoDFwKroNwLD/7t9vYKENjrcKVZg5tgJuuUj8D4rZtP6iVCjSB1LTLYmUs4L/EmCqIyLR/Q==
xterm-addon-webgl@0.9.0-beta.1:
version "0.9.0-beta.1"
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.9.0-beta.1.tgz#e0a4e9b71db7ef8182064236844caf32833214c2"
integrity sha512-yyIYfehzaqaOTOTjSapA3sEcaGDIPn0xAiWyRIWyW5zwTZIo7FA+O4IzhgAT9b7ioJWLcPoHPUA0OFNHAx20vQ==
xterm-addon-webgl@0.9.0-beta.4:
version "0.9.0-beta.4"
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.9.0-beta.4.tgz#5f5fde50db5c06b116471bcf56ad9930884b36fa"
integrity sha512-GuCvF7Eg1nKLX6zUbJLkt5cqeeccUjf/G6fugCfrkR0EWWC6Ik5mEsEOs5UWm9vvY2kX9t16BdCrgqp8KJegEg==
xterm@4.9.0-beta.25:
version "4.9.0-beta.25"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.9.0-beta.25.tgz#c229a144184ab7b3c3afdaff76f9d81bac58933b"
integrity sha512-NJHwuS7Qsoq/Yuobl+Au4rgol/oBNj4pGoR2R6IRnXODS5RDE4spHDofWKiUkDMlNZtPPku1W7k1kFnonDIhhg==
xterm@4.9.0-beta.32:
version "4.9.0-beta.32"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.9.0-beta.32.tgz#d1243d3be211cc06aad3418e696e4eced995c20c"
integrity sha512-jloHNBnj6XRJt+oPkapvrXJZVsYq6se/PEgzErl0iZn9qzSB3jmWE4byumoEjXJR6EgU5ZOmNljeeEDA9jO/jA==
yauzl@^2.9.2:
version "2.10.0"

View file

@ -12,7 +12,6 @@ import { onUnexpectedError } from 'vs/base/common/errors';
import { Emitter, Event } from 'vs/base/common/event';
import { Disposable, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import * as platform from 'vs/base/common/platform';
import { coalesce } from 'vs/base/common/arrays';
import { URI } from 'vs/base/common/uri';
import { Schemas, RemoteAuthorities } from 'vs/base/common/network';
import { BrowserFeatures } from 'vs/base/browser/canIUse';
@ -1012,20 +1011,23 @@ export function prepend<T extends Node>(parent: HTMLElement, child: T): T {
return child;
}
const SELECTOR_REGEX = /([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;
export function reset<T extends Node>(parent: HTMLElement, ...children: Array<Node | string>) {
/**
* Removes all children from `parent` and appends `children`
*/
export function reset(parent: HTMLElement, ...children: Array<Node | string>) {
parent.innerText = '';
coalesce(children)
.forEach(child => {
if (child instanceof Node) {
parent.appendChild(child);
} else {
parent.appendChild(document.createTextNode(child as string));
}
});
for (const child of children) {
if (child instanceof Node) {
parent.appendChild(child);
} else if (typeof child === 'string') {
parent.appendChild(document.createTextNode(child));
}
}
}
const SELECTOR_REGEX = /([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;
export enum Namespace {
HTML = 'http://www.w3.org/1999/xhtml',
SVG = 'http://www.w3.org/2000/svg'
@ -1075,14 +1077,13 @@ function _$<T extends Element>(namespace: Namespace, description: string, attrs?
}
});
coalesce(children)
.forEach(child => {
if (child instanceof Node) {
result.appendChild(child);
} else {
result.appendChild(document.createTextNode(child as string));
}
});
for (const child of children) {
if (child instanceof Node) {
result.appendChild(child);
} else if (typeof child === 'string') {
result.appendChild(document.createTextNode(child));
}
}
return result as T;
}

View file

@ -118,7 +118,7 @@ export class BreadcrumbsWidget {
dispose(): void {
this._disposables.dispose();
dispose(this._pendingLayout);
this._pendingLayout?.dispose();
this._onDidSelectItem.dispose();
this._onDidFocusItem.dispose();
this._onDidChangeFocus.dispose();
@ -131,9 +131,7 @@ export class BreadcrumbsWidget {
if (dim && dom.Dimension.equals(dim, this._dimension)) {
return;
}
if (this._pendingLayout) {
this._pendingLayout.dispose();
}
this._pendingLayout?.dispose();
if (dim) {
// only measure
this._pendingLayout = this._updateDimensions(dim);

View file

@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
import * as objects from 'vs/base/common/objects';
import { renderCodicons } from 'vs/base/common/codicons';
import { escape } from 'vs/base/common/strings';
import * as dom from 'vs/base/browser/dom';
import { renderCodiconsAsElement } from 'vs/base/browser/codicons';
export interface IHighlight {
start: number;
@ -15,7 +15,7 @@ export interface IHighlight {
export class HighlightedLabel {
private domNode: HTMLElement;
private readonly domNode: HTMLElement;
private text: string = '';
private title: string = '';
private highlights: IHighlight[] = [];
@ -44,10 +44,6 @@ export class HighlightedLabel {
return;
}
if (!Array.isArray(highlights)) {
highlights = [];
}
this.text = text;
this.title = title;
this.highlights = highlights;
@ -56,7 +52,7 @@ export class HighlightedLabel {
private render(): void {
let htmlContent = '';
const children: HTMLSpanElement[] = [];
let pos = 0;
for (const highlight of this.highlights) {
@ -64,31 +60,26 @@ export class HighlightedLabel {
continue;
}
if (pos < highlight.start) {
htmlContent += '<span>';
const substring = this.text.substring(pos, highlight.start);
htmlContent += this.supportCodicons ? renderCodicons(escape(substring)) : escape(substring);
htmlContent += '</span>';
children.push(dom.$('span', undefined, ...this.supportCodicons ? renderCodiconsAsElement(substring) : [substring]));
pos = highlight.end;
}
if (highlight.extraClasses) {
htmlContent += `<span class="highlight ${highlight.extraClasses}">`;
} else {
htmlContent += `<span class="highlight">`;
}
const substring = this.text.substring(highlight.start, highlight.end);
htmlContent += this.supportCodicons ? renderCodicons(escape(substring)) : escape(substring);
htmlContent += '</span>';
const element = dom.$('span.highlight', undefined, ...this.supportCodicons ? renderCodiconsAsElement(substring) : [substring]);
if (highlight.extraClasses) {
element.classList.add(highlight.extraClasses);
}
children.push(element);
pos = highlight.end;
}
if (pos < this.text.length) {
htmlContent += '<span>';
const substring = this.text.substring(pos);
htmlContent += this.supportCodicons ? renderCodicons(escape(substring)) : escape(substring);
htmlContent += '</span>';
const substring = this.text.substring(pos,);
children.push(dom.$('span', undefined, ...this.supportCodicons ? renderCodiconsAsElement(substring) : [substring]));
}
this.domNode.innerHTML = htmlContent;
dom.reset(this.domNode, ...children);
if (this.title) {
this.domNode.title = this.title;
} else {

View file

@ -896,7 +896,9 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
this.render(previousRenderRange, e.scrollTop, e.height, e.scrollLeft, e.scrollWidth);
if (this.supportDynamicHeights) {
this._rerender(e.scrollTop, e.height);
// Don't update scrollTop from within an scroll event
// so we don't break smooth scrolling. #104144
this._rerender(e.scrollTop, e.height, false);
}
} catch (err) {
console.error('Got bad scroll event:', e);
@ -1166,7 +1168,7 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
* Given a stable rendered state, checks every rendered element whether it needs
* to be probed for dynamic height. Adjusts scroll height and top if necessary.
*/
private _rerender(renderTop: number, renderHeight: number): void {
private _rerender(renderTop: number, renderHeight: number, updateScrollTop: boolean = true): void {
const previousRenderRange = this.getRenderRange(renderTop, renderHeight);
// Let's remember the second element's position, this helps in scrolling up
@ -1232,7 +1234,7 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
}
}
if (typeof anchorElementIndex === 'number') {
if (updateScrollTop && typeof anchorElementIndex === 'number') {
this.scrollTop = this.elementTop(anchorElementIndex) - anchorElementTopDelta!;
}

View file

@ -503,42 +503,15 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
// Iterate over detailed descriptions, find max height
private measureMaxDetailsHeight(): number {
let maxDetailsPaneHeight = 0;
this.options.forEach((option, index) => {
this.selectionDetailsPane.innerText = '';
if (option.description) {
if (option.descriptionIsMarkdown) {
this.selectionDetailsPane.appendChild(this.renderDescriptionMarkdown(option.description));
} else {
this.selectionDetailsPane.innerText = option.description;
}
this.selectionDetailsPane.style.display = 'block';
} else {
this.selectionDetailsPane.style.display = 'none';
}
this.options.forEach((_option, index) => {
this.updateDetail(index);
if (this.selectionDetailsPane.offsetHeight > maxDetailsPaneHeight) {
maxDetailsPaneHeight = this.selectionDetailsPane.offsetHeight;
}
});
// Reset description to selected
this.selectionDetailsPane.innerText = '';
const description = this.options[this.selected].description || null;
const descriptionIsMarkdown = this.options[this.selected].descriptionIsMarkdown || null;
if (description) {
if (descriptionIsMarkdown) {
this.selectionDetailsPane.appendChild(this.renderDescriptionMarkdown(description));
} else {
this.selectionDetailsPane.innerText = description;
}
this.selectionDetailsPane.style.display = 'block';
}
return maxDetailsPaneHeight;
}
@ -676,6 +649,8 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
this.selectDropDownContainer.style.height = (listHeight + verticalPadding) + 'px';
}
this.updateDetail(this.selected);
this.selectDropDownContainer.style.width = selectOptimalWidth;
// Maintain focus outline on parent select as well as list container - tabindex for focus
@ -870,8 +845,11 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
return;
}
this.updateDetail(e.indexes[0]);
}
private updateDetail(selectedIndex: number): void {
this.selectionDetailsPane.innerText = '';
const selectedIndex = e.indexes[0];
const description = this.options[selectedIndex].description;
const descriptionIsMarkdown = this.options[selectedIndex].descriptionIsMarkdown;

View file

@ -22,7 +22,7 @@ export class SkipList<K, V> implements Map<K, V> {
readonly [Symbol.toStringTag] = 'SkipList';
private _maxLevel: number;
private _level: number = 1;
private _level: number = 0;
private _header: Node<K, V>;
private _size: number = 0;
@ -122,7 +122,7 @@ export class SkipList<K, V> implements Map<K, V> {
private static _search<K, V>(list: SkipList<K, V>, searchKey: K, comparator: Comparator<K>) {
let x = list._header;
for (let i = list._level; i >= 0; i--) {
for (let i = list._level - 1; i >= 0; i--) {
while (x.forward[i] && comparator(x.forward[i].key, searchKey) < 0) {
x = x.forward[i];
}
@ -137,7 +137,7 @@ export class SkipList<K, V> implements Map<K, V> {
private static _insert<K, V>(list: SkipList<K, V>, searchKey: K, value: V, comparator: Comparator<K>) {
let update: Node<K, V>[] = [];
let x = list._header;
for (let i = list._level; i >= 0; i--) {
for (let i = list._level - 1; i >= 0; i--) {
while (x.forward[i] && comparator(x.forward[i].key, searchKey) < 0) {
x = x.forward[i];
}
@ -152,13 +152,13 @@ export class SkipList<K, V> implements Map<K, V> {
// insert
let lvl = SkipList._randomLevel(list);
if (lvl > list._level) {
for (let i = list._level + 1; i <= lvl; i++) {
for (let i = list._level; i < lvl; i++) {
update[i] = list._header;
}
list._level = lvl;
}
x = new Node<K, V>(lvl, searchKey, value);
for (let i = 0; i <= lvl; i++) {
for (let i = 0; i < lvl; i++) {
x.forward[i] = update[i].forward[i];
update[i].forward[i] = x;
}
@ -177,7 +177,7 @@ export class SkipList<K, V> implements Map<K, V> {
private static _delete<K, V>(list: SkipList<K, V>, searchKey: K, comparator: Comparator<K>) {
let update: Node<K, V>[] = [];
let x = list._header;
for (let i = list._level; i >= 0; i--) {
for (let i = list._level - 1; i >= 0; i--) {
while (x.forward[i] && comparator(x.forward[i].key, searchKey) < 0) {
x = x.forward[i];
}
@ -194,7 +194,7 @@ export class SkipList<K, V> implements Map<K, V> {
}
update[i].forward[i] = x.forward[i];
}
while (list._level >= 1 && list._header.forward[list._level] === NIL) {
while (list._level > 0 && list._header.forward[list._level - 1] === NIL) {
list._level -= 1;
}
return true;

View file

@ -5,13 +5,15 @@
import { CancellationToken } from 'vs/base/common/cancellation';
import { canceled } from 'vs/base/common/errors';
import { assign } from 'vs/base/common/objects';
import { VSBuffer, bufferToStream } from 'vs/base/common/buffer';
import { IRequestOptions, IRequestContext } from 'vs/base/parts/request/common/request';
export function request(options: IRequestOptions, token: CancellationToken): Promise<IRequestContext> {
if (options.proxyAuthorization) {
options.headers = assign(options.headers || {}, { 'Proxy-Authorization': options.proxyAuthorization });
options.headers = {
...(options.headers || {}),
'Proxy-Authorization': options.proxyAuthorization
};
}
const xhr = new XMLHttpRequest();

View file

@ -76,7 +76,7 @@ bootstrapWindow.load([
/**
* @param {{
* partsSplashPath?: string,
* colorScheme: (1 | 2 | 3),
* colorScheme: ('light' | 'dark' | 'hc'),
* autoDetectHighContrast?: boolean,
* extensionDevelopmentPath?: string[],
* folderUri?: object,
@ -96,7 +96,7 @@ function showPartsSplash(configuration) {
}
// high contrast mode has been turned on from the outside, e.g. OS -> ignore stored colors and layouts
const isHighContrast = configuration.colorScheme === 3 /* ColorScheme.HIGH_CONTRAST */ && configuration.autoDetectHighContrast;
const isHighContrast = configuration.colorScheme === 'hc' /* ColorScheme.HIGH_CONTRAST */ && configuration.autoDetectHighContrast;
if (data && isHighContrast && data.baseTheme !== 'hc-black') {
data = undefined;
}

View file

@ -55,7 +55,7 @@ export class ProxyAuthHandler extends Disposable {
skipTaskbar: true,
resizable: false,
width: 450,
height: 220,
height: 225,
show: true,
title: 'VS Code',
webPreferences: {

View file

@ -184,7 +184,7 @@ class CodeMain {
environmentService.logsPath,
environmentService.globalStorageHome.fsPath,
environmentService.workspaceStorageHome.fsPath,
environmentService.backupHome.fsPath
environmentService.backupHome
].map((path): undefined | Promise<void> => path ? mkdirp(path) : undefined));
// Configuration service

View file

@ -15,7 +15,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { parseArgs, OPTIONS } from 'vs/platform/environment/node/argv';
import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
import product from 'vs/platform/product/common/product';
import { IWindowSettings, MenuBarVisibility, getTitleBarStyle, getMenuBarVisibility, zoomLevelToZoomFactor, INativeWindowConfiguration, ColorScheme } from 'vs/platform/windows/common/windows';
import { IWindowSettings, MenuBarVisibility, getTitleBarStyle, getMenuBarVisibility, zoomLevelToZoomFactor, INativeWindowConfiguration } from 'vs/platform/windows/common/windows';
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
import { isLinux, isMacintosh, isWindows } from 'vs/base/common/platform';
import { ICodeWindow, IWindowState, WindowMode } from 'vs/platform/windows/electron-main/windows';
@ -34,6 +34,7 @@ import { ThemeIcon } from 'vs/platform/theme/common/themeService';
import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
import { IStorageMainService } from 'vs/platform/storage/node/storageMainService';
import { IFileService } from 'vs/platform/files/common/files';
import { ColorScheme } from 'vs/platform/theme/common/theme';
export interface IWindowCreationOptions {
state: IWindowState;
@ -784,7 +785,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
windowConfiguration.fullscreen = this.isFullScreen;
// Set Accessibility Config
windowConfiguration.colorScheme = (nativeTheme.shouldUseInvertedColorScheme || nativeTheme.shouldUseHighContrastColors) ? ColorScheme.HIGH_CONTRAST : nativeTheme.shouldUseDarkColors ? ColorScheme.DARK : ColorScheme.DEFAULT;
windowConfiguration.colorScheme = (nativeTheme.shouldUseInvertedColorScheme || nativeTheme.shouldUseHighContrastColors) ? ColorScheme.HIGH_CONTRAST : nativeTheme.shouldUseDarkColors ? ColorScheme.DARK : ColorScheme.LIGHT;
windowConfiguration.autoDetectHighContrast = windowConfig?.autoDetectHighContrast ?? true;
windowConfiguration.accessibilitySupport = app.accessibilitySupportEnabled;

View file

@ -15,7 +15,7 @@ import { LineDecoration } from 'vs/editor/common/viewLayout/lineDecorations';
import { CharacterMapping, ForeignElementType, RenderLineInput, renderViewLine, LineRange } from 'vs/editor/common/viewLayout/viewLineRenderer';
import { ViewportData } from 'vs/editor/common/viewLayout/viewLinesViewportData';
import { InlineDecorationType } from 'vs/editor/common/viewModel/viewModel';
import { HIGH_CONTRAST, ThemeType } from 'vs/platform/theme/common/themeService';
import { ColorScheme } from 'vs/platform/theme/common/theme';
import { EditorOption, EditorFontLigatures } from 'vs/editor/common/config/editorOptions';
const canUseFastRenderedViewLine = (function () {
@ -71,7 +71,7 @@ export class DomReadingContext {
}
export class ViewLineOptions {
public readonly themeType: ThemeType;
public readonly themeType: ColorScheme;
public readonly renderWhitespace: 'none' | 'boundary' | 'selection' | 'trailing' | 'all';
public readonly renderControlCharacters: boolean;
public readonly spaceWidth: number;
@ -83,7 +83,7 @@ export class ViewLineOptions {
public readonly stopRenderingLineAfter: number;
public readonly fontLigatures: string;
constructor(config: IConfiguration, themeType: ThemeType) {
constructor(config: IConfiguration, themeType: ColorScheme) {
this.themeType = themeType;
const options = config.options;
const fontInfo = options.get(EditorOption.fontInfo);
@ -163,7 +163,7 @@ export class ViewLine implements IVisibleLine {
this._options = newOptions;
}
public onSelectionChanged(): boolean {
if (alwaysRenderInlineSelection || this._options.themeType === HIGH_CONTRAST || this._options.renderWhitespace === 'selection') {
if (alwaysRenderInlineSelection || this._options.themeType === ColorScheme.HIGH_CONTRAST || this._options.renderWhitespace === 'selection') {
this._isMaybeInvalid = true;
return true;
}
@ -184,7 +184,7 @@ export class ViewLine implements IVisibleLine {
// Only send selection information when needed for rendering whitespace
let selectionsOnLine: LineRange[] | null = null;
if (alwaysRenderInlineSelection || options.themeType === HIGH_CONTRAST || this._options.renderWhitespace === 'selection') {
if (alwaysRenderInlineSelection || options.themeType === ColorScheme.HIGH_CONTRAST || this._options.renderWhitespace === 'selection') {
const selections = viewportData.selections;
for (const selection of selections) {
@ -197,7 +197,7 @@ export class ViewLine implements IVisibleLine {
const endColumn = (selection.endLineNumber === lineNumber ? selection.endColumn : lineData.maxColumn);
if (startColumn < endColumn) {
if (options.themeType === HIGH_CONTRAST || this._options.renderWhitespace !== 'selection') {
if (options.themeType === ColorScheme.HIGH_CONTRAST || this._options.renderWhitespace !== 'selection') {
actualInlineDecorations.push(new LineDecoration(startColumn, endColumn, 'inline-selected-text', InlineDecorationType.Regular));
} else {
if (!selectionsOnLine) {

View file

@ -4,7 +4,10 @@
*--------------------------------------------------------------------------------------------*/
import { Emitter, Event } from 'vs/base/common/event';
import { hash } from 'vs/base/common/hash';
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { LRUCache } from 'vs/base/common/map';
import { MovingAverage } from 'vs/base/common/numbers';
import { ITextModel } from 'vs/editor/common/model';
import { LanguageSelector, score } from 'vs/editor/common/modes/languageSelector';
import { shouldSynchronizeModel } from 'vs/editor/common/services/modelService';
@ -174,3 +177,46 @@ export class LanguageFeatureRegistry<T> {
}
}
}
/**
* Keeps moving average per model and set of providers so that requests
* can be debounce according to the provider performance
*/
export class LanguageFeatureRequestDelays {
private readonly _cache = new LRUCache<string, MovingAverage>(50, 0.7);
constructor(
private readonly _registry: LanguageFeatureRegistry<any>,
readonly min: number,
readonly max: number = Number.MAX_SAFE_INTEGER,
) { }
private _key(model: ITextModel): string {
return model.id + hash(this._registry.all(model));
}
private _clamp(value: number | undefined): number {
if (value === undefined) {
return this.min;
} else {
return Math.min(this.max, Math.max(this.min, Math.floor(value * 1.3)));
}
}
get(model: ITextModel): number {
const key = this._key(model);
return this._clamp(this._cache.get(key)?.value);
}
update(model: ITextModel, value: number) {
const key = this._key(model);
let avg = this._cache.get(key);
if (!avg) {
avg = new MovingAverage();
this._cache.set(key, avg);
}
avg.update(value);
}
}

View file

@ -399,10 +399,10 @@ export function generateTokensCSSForColorMap(colorMap: Color[]): string {
let rules: string[] = [];
for (let i = 1, len = colorMap.length; i < len; i++) {
let color = colorMap[i];
rules[i] = `.monaco-editor .mtk${i} { color: ${color}; }`;
rules[i] = `.mtk${i} { color: ${color}; }`;
}
rules.push('.monaco-editor .mtki { font-style: italic; }');
rules.push('.monaco-editor .mtkb { font-weight: bold; }');
rules.push('.monaco-editor .mtku { text-decoration: underline; text-underline-position: under; }');
rules.push('.mtki { font-style: italic; }');
rules.push('.mtkb { font-weight: bold; }');
rules.push('.mtku { text-decoration: underline; text-underline-position: under; }');
return rules.join('\n');
}

View file

@ -6,15 +6,16 @@
import { IConfiguration } from 'vs/editor/common/editorCommon';
import { ViewEventHandler } from 'vs/editor/common/viewModel/viewEventHandler';
import { IViewLayout, IViewModel } from 'vs/editor/common/viewModel/viewModel';
import { IColorTheme, ThemeType } from 'vs/platform/theme/common/themeService';
import { IColorTheme } from 'vs/platform/theme/common/themeService';
import { ColorIdentifier } from 'vs/platform/theme/common/colorRegistry';
import { Color } from 'vs/base/common/color';
import { ColorScheme } from 'vs/platform/theme/common/theme';
export class EditorTheme {
private _theme: IColorTheme;
public get type(): ThemeType {
public get type(): ColorScheme {
return this._theme.type;
}

View file

@ -36,44 +36,47 @@ export class CodeLensModel {
}
}
export function getCodeLensData(model: ITextModel, token: CancellationToken): Promise<CodeLensModel> {
export async function getCodeLensModel(model: ITextModel, token: CancellationToken): Promise<CodeLensModel> {
const provider = CodeLensProviderRegistry.ordered(model);
const providerRanks = new Map<CodeLensProvider, number>();
const result = new CodeLensModel();
const promises = provider.map((provider, i) => {
const promises = provider.map(async (provider, i) => {
providerRanks.set(provider, i);
return Promise.resolve(provider.provideCodeLenses(model, token))
.then(list => list && result.add(list, provider))
.catch(onUnexpectedExternalError);
});
return Promise.all(promises).then(() => {
result.lenses = mergeSort(result.lenses, (a, b) => {
// sort by lineNumber, provider-rank, and column
if (a.symbol.range.startLineNumber < b.symbol.range.startLineNumber) {
return -1;
} else if (a.symbol.range.startLineNumber > b.symbol.range.startLineNumber) {
return 1;
} else if (providerRanks.get(a.provider)! < providerRanks.get(b.provider)!) {
return -1;
} else if (providerRanks.get(a.provider)! > providerRanks.get(b.provider)!) {
return 1;
} else if (a.symbol.range.startColumn < b.symbol.range.startColumn) {
return -1;
} else if (a.symbol.range.startColumn > b.symbol.range.startColumn) {
return 1;
} else {
return 0;
try {
const list = await Promise.resolve(provider.provideCodeLenses(model, token));
if (list) {
result.add(list, provider);
}
});
return result;
} catch (err) {
onUnexpectedExternalError(err);
}
});
await Promise.all(promises);
result.lenses = mergeSort(result.lenses, (a, b) => {
// sort by lineNumber, provider-rank, and column
if (a.symbol.range.startLineNumber < b.symbol.range.startLineNumber) {
return -1;
} else if (a.symbol.range.startLineNumber > b.symbol.range.startLineNumber) {
return 1;
} else if ((providerRanks.get(a.provider)!) < (providerRanks.get(b.provider)!)) {
return -1;
} else if ((providerRanks.get(a.provider)!) > (providerRanks.get(b.provider)!)) {
return 1;
} else if (a.symbol.range.startColumn < b.symbol.range.startColumn) {
return -1;
} else if (a.symbol.range.startColumn > b.symbol.range.startColumn) {
return 1;
} else {
return 0;
}
});
return result;
}
registerLanguageCommand('_executeCodeLensProvider', function (accessor, args) {
@ -90,7 +93,7 @@ registerLanguageCommand('_executeCodeLensProvider', function (accessor, args) {
const result: CodeLens[] = [];
const disposables = new DisposableStore();
return getCodeLensData(model, CancellationToken.None).then(value => {
return getCodeLensModel(model, CancellationToken.None).then(value => {
disposables.add(value);
let resolve: Promise<any>[] = [];

View file

@ -5,14 +5,14 @@
import { CancelablePromise, RunOnceScheduler, createCancelablePromise, disposableTimeout } from 'vs/base/common/async';
import { onUnexpectedError, onUnexpectedExternalError } from 'vs/base/common/errors';
import { toDisposable, DisposableStore, dispose } from 'vs/base/common/lifecycle';
import { toDisposable, DisposableStore } from 'vs/base/common/lifecycle';
import { StableEditorScrollState } from 'vs/editor/browser/core/editorState';
import { ICodeEditor, MouseTargetType, IViewZoneChangeAccessor, IActiveCodeEditor } from 'vs/editor/browser/editorBrowser';
import { registerEditorContribution, ServicesAccessor, registerEditorAction, EditorAction } from 'vs/editor/browser/editorExtensions';
import { IEditorContribution } from 'vs/editor/common/editorCommon';
import { IModelDecorationsChangeAccessor } from 'vs/editor/common/model';
import { CodeLensProviderRegistry, CodeLens, Command } from 'vs/editor/common/modes';
import { CodeLensModel, getCodeLensData, CodeLensItem } from 'vs/editor/contrib/codelens/codelens';
import { CodeLensModel, getCodeLensModel, CodeLensItem } from 'vs/editor/contrib/codelens/codelens';
import { CodeLensWidget, CodeLensHelper } from 'vs/editor/contrib/codelens/codelensWidget';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { INotificationService } from 'vs/platform/notification/common/notification';
@ -23,24 +23,25 @@ import { hash } from 'vs/base/common/hash';
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
import { localize } from 'vs/nls';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { LanguageFeatureRequestDelays } from 'vs/editor/common/modes/languageFeatureRegistry';
export class CodeLensContribution implements IEditorContribution {
public static readonly ID: string = 'css.editor.codeLens';
static readonly ID: string = 'css.editor.codeLens';
private _isEnabled: boolean;
private readonly _globalToDispose = new DisposableStore();
private readonly _disposables = new DisposableStore();
private readonly _localToDispose = new DisposableStore();
private readonly _styleElement: HTMLStyleElement;
private readonly _styleClassName: string;
private _lenses: CodeLensWidget[] = [];
private _currentFindCodeLensSymbolsPromise: CancelablePromise<CodeLensModel> | undefined;
private readonly _lenses: CodeLensWidget[] = [];
private readonly _getCodeLensModelDelays = new LanguageFeatureRequestDelays(CodeLensProviderRegistry, 250, 2500);
private _getCodeLensModelPromise: CancelablePromise<CodeLensModel> | undefined;
private _oldCodeLensModels = new DisposableStore();
private _currentCodeLensModel: CodeLensModel | undefined;
private _modelChangeCounter: number = 0;
private _currentResolveCodeLensSymbolsPromise: CancelablePromise<any> | undefined;
private _detectVisibleLenses: RunOnceScheduler | undefined;
private readonly _resolveCodeLensesDelays = new LanguageFeatureRequestDelays(CodeLensProviderRegistry, 250, 2500);
private readonly _resolveCodeLensesScheduler = new RunOnceScheduler(() => this._resolveCodeLensesInViewport(), this._resolveCodeLensesDelays.min);
private _resolveCodeLensesPromise: CancelablePromise<any> | undefined;
constructor(
private readonly _editor: ICodeEditor,
@ -48,23 +49,18 @@ export class CodeLensContribution implements IEditorContribution {
@INotificationService private readonly _notificationService: INotificationService,
@ICodeLensCache private readonly _codeLensCache: ICodeLensCache
) {
this._isEnabled = this._editor.getOption(EditorOption.codeLens);
this._globalToDispose.add(this._editor.onDidChangeModel(() => this._onModelChange()));
this._globalToDispose.add(this._editor.onDidChangeModelLanguage(() => this._onModelChange()));
this._globalToDispose.add(this._editor.onDidChangeConfiguration(() => {
const prevIsEnabled = this._isEnabled;
this._isEnabled = this._editor.getOption(EditorOption.codeLens);
if (prevIsEnabled !== this._isEnabled) {
this._onModelChange();
}
}));
this._globalToDispose.add(CodeLensProviderRegistry.onDidChange(this._onModelChange, this));
this._globalToDispose.add(this._editor.onDidChangeConfiguration(e => {
this._disposables.add(this._editor.onDidChangeModel(() => this._onModelChange()));
this._disposables.add(this._editor.onDidChangeModelLanguage(() => this._onModelChange()));
this._disposables.add(this._editor.onDidChangeConfiguration((e) => {
if (e.hasChanged(EditorOption.fontInfo)) {
this._updateLensStyle();
}
if (e.hasChanged(EditorOption.codeLens)) {
this._onModelChange();
}
}));
this._disposables.add(CodeLensProviderRegistry.onDidChange(this._onModelChange, this));
this._onModelChange();
this._styleClassName = '_' + hash(this._editor.getId()).toString(16);
@ -78,9 +74,9 @@ export class CodeLensContribution implements IEditorContribution {
dispose(): void {
this._localDispose();
this._globalToDispose.dispose();
this._disposables.dispose();
this._oldCodeLensModels.dispose();
dispose(this._currentCodeLensModel);
this._currentCodeLensModel?.dispose();
}
private _updateLensStyle(): void {
@ -99,18 +95,13 @@ export class CodeLensContribution implements IEditorContribution {
}
private _localDispose(): void {
if (this._currentFindCodeLensSymbolsPromise) {
this._currentFindCodeLensSymbolsPromise.cancel();
this._currentFindCodeLensSymbolsPromise = undefined;
this._modelChangeCounter++;
}
if (this._currentResolveCodeLensSymbolsPromise) {
this._currentResolveCodeLensSymbolsPromise.cancel();
this._currentResolveCodeLensSymbolsPromise = undefined;
}
this._getCodeLensModelPromise?.cancel();
this._getCodeLensModelPromise = undefined;
this._resolveCodeLensesPromise?.cancel();
this._resolveCodeLensesPromise = undefined;
this._localToDispose.clear();
this._oldCodeLensModels.clear();
dispose(this._currentCodeLensModel);
this._currentCodeLensModel?.dispose();
}
private _onModelChange(): void {
@ -122,7 +113,7 @@ export class CodeLensContribution implements IEditorContribution {
return;
}
if (!this._isEnabled) {
if (!this._editor.getOption(EditorOption.codeLens)) {
return;
}
@ -153,34 +144,33 @@ export class CodeLensContribution implements IEditorContribution {
}
}
const detectVisibleLenses = this._detectVisibleLenses = new RunOnceScheduler(() => this._onViewportChanged(), 250);
const scheduler = new RunOnceScheduler(() => {
const counterValue = ++this._modelChangeCounter;
if (this._currentFindCodeLensSymbolsPromise) {
this._currentFindCodeLensSymbolsPromise.cancel();
}
const t1 = Date.now();
this._currentFindCodeLensSymbolsPromise = createCancelablePromise(token => getCodeLensData(model, token));
this._getCodeLensModelPromise?.cancel();
this._getCodeLensModelPromise = createCancelablePromise(token => getCodeLensModel(model, token));
this._currentFindCodeLensSymbolsPromise.then(result => {
if (counterValue === this._modelChangeCounter) { // only the last one wins
if (this._currentCodeLensModel) {
this._oldCodeLensModels.add(this._currentCodeLensModel);
}
this._currentCodeLensModel = result;
// cache model to reduce flicker
this._codeLensCache.put(model, result);
// render lenses
this._renderCodeLensSymbols(result);
detectVisibleLenses.schedule();
this._getCodeLensModelPromise.then(result => {
if (this._currentCodeLensModel) {
this._oldCodeLensModels.add(this._currentCodeLensModel);
}
this._currentCodeLensModel = result;
// cache model to reduce flicker
this._codeLensCache.put(model, result);
// update moving average
this._getCodeLensModelDelays.update(model, Date.now() - t1);
// render lenses
this._renderCodeLensSymbols(result);
this._resolveCodeLensesInViewportSoon();
}, onUnexpectedError);
}, 250);
}, this._getCodeLensModelDelays.get(model));
this._localToDispose.add(scheduler);
this._localToDispose.add(detectVisibleLenses);
this._localToDispose.add(toDisposable(() => this._resolveCodeLensesScheduler.cancel()));
this._localToDispose.add(this._editor.onDidChangeModelContent(() => {
this._editor.changeDecorations(decorationsAccessor => {
this._editor.changeViewZones(viewZonesAccessor => {
@ -209,17 +199,17 @@ export class CodeLensContribution implements IEditorContribution {
});
// Compute new `visible` code lenses
detectVisibleLenses.schedule();
this._resolveCodeLensesInViewportSoon();
// Ask for all references again
scheduler.schedule();
}));
this._localToDispose.add(this._editor.onDidScrollChange(e => {
if (e.scrollTopChanged && this._lenses.length > 0) {
detectVisibleLenses.schedule();
this._resolveCodeLensesInViewportSoon();
}
}));
this._localToDispose.add(this._editor.onDidLayoutChange(() => {
detectVisibleLenses.schedule();
this._resolveCodeLensesInViewportSoon();
}));
this._localToDispose.add(toDisposable(() => {
if (this._editor.getModel()) {
@ -264,7 +254,7 @@ export class CodeLensContribution implements IEditorContribution {
if (decChangeAccessor) {
helper.commit(decChangeAccessor);
}
this._lenses = [];
this._lenses.length = 0;
}
private _renderCodeLensSymbols(symbols: CodeLensModel): void {
@ -313,7 +303,7 @@ export class CodeLensContribution implements IEditorContribution {
groupsIndex++;
codeLensIndex++;
} else {
this._lenses.splice(codeLensIndex, 0, new CodeLensWidget(groups[groupsIndex], <IActiveCodeEditor>this._editor, this._styleClassName, helper, viewZoneAccessor, () => this._detectVisibleLenses && this._detectVisibleLenses.schedule()));
this._lenses.splice(codeLensIndex, 0, new CodeLensWidget(groups[groupsIndex], <IActiveCodeEditor>this._editor, this._styleClassName, helper, viewZoneAccessor, () => this._resolveCodeLensesInViewportSoon()));
codeLensIndex++;
groupsIndex++;
}
@ -327,7 +317,7 @@ export class CodeLensContribution implements IEditorContribution {
// Create extra symbols
while (groupsIndex < groups.length) {
this._lenses.push(new CodeLensWidget(groups[groupsIndex], <IActiveCodeEditor>this._editor, this._styleClassName, helper, viewZoneAccessor, () => this._detectVisibleLenses && this._detectVisibleLenses.schedule()));
this._lenses.push(new CodeLensWidget(groups[groupsIndex], <IActiveCodeEditor>this._editor, this._styleClassName, helper, viewZoneAccessor, () => this._resolveCodeLensesInViewportSoon()));
groupsIndex++;
}
@ -338,11 +328,17 @@ export class CodeLensContribution implements IEditorContribution {
scrollState.restore(this._editor);
}
private _onViewportChanged(): void {
if (this._currentResolveCodeLensSymbolsPromise) {
this._currentResolveCodeLensSymbolsPromise.cancel();
this._currentResolveCodeLensSymbolsPromise = undefined;
private _resolveCodeLensesInViewportSoon(): void {
const model = this._editor.getModel();
if (model) {
this._resolveCodeLensesScheduler.schedule(this._resolveCodeLensesDelays.get(model));
}
}
private _resolveCodeLensesInViewport(): void {
this._resolveCodeLensesPromise?.cancel();
this._resolveCodeLensesPromise = undefined;
const model = this._editor.getModel();
if (!model) {
@ -363,6 +359,8 @@ export class CodeLensContribution implements IEditorContribution {
return;
}
const t1 = Date.now();
const resolvePromise = createCancelablePromise(token => {
const promises = toResolve.map((request, i) => {
@ -388,20 +386,24 @@ export class CodeLensContribution implements IEditorContribution {
return Promise.all(promises);
});
this._currentResolveCodeLensSymbolsPromise = resolvePromise;
this._resolveCodeLensesPromise = resolvePromise;
this._resolveCodeLensesPromise.then(() => {
// update moving average
this._resolveCodeLensesDelays.update(model, Date.now() - t1);
this._currentResolveCodeLensSymbolsPromise.then(() => {
if (this._currentCodeLensModel) { // update the cached state with new resolved items
this._codeLensCache.put(model, this._currentCodeLensModel);
}
this._oldCodeLensModels.clear(); // dispose old models once we have updated the UI with the current model
if (resolvePromise === this._currentResolveCodeLensSymbolsPromise) {
this._currentResolveCodeLensSymbolsPromise = undefined;
if (resolvePromise === this._resolveCodeLensesPromise) {
this._resolveCodeLensesPromise = undefined;
}
}, err => {
onUnexpectedError(err); // can also be cancellation!
if (resolvePromise === this._currentResolveCodeLensSymbolsPromise) {
this._currentResolveCodeLensSymbolsPromise = undefined;
if (resolvePromise === this._resolveCodeLensesPromise) {
this._resolveCodeLensesPromise = undefined;
}
});
}

View file

@ -14,8 +14,8 @@ import { ITextModel } from 'vs/editor/common/model';
import { DocumentSymbol, DocumentSymbolProvider, DocumentSymbolProviderRegistry } from 'vs/editor/common/modes';
import { MarkerSeverity } from 'vs/platform/markers/common/markers';
import { Iterable } from 'vs/base/common/iterator';
import { MovingAverage } from 'vs/base/common/numbers';
import { URI } from 'vs/base/common/uri';
import { LanguageFeatureRequestDelays } from 'vs/editor/common/modes/languageFeatureRegistry';
export abstract class TreeElement {
@ -208,7 +208,7 @@ export class OutlineGroup extends TreeElement {
export class OutlineModel extends TreeElement {
private static readonly _requestDurations = new LRUCache<string, MovingAverage>(50, 0.7);
private static readonly _requestDurations = new LanguageFeatureRequestDelays(DocumentSymbolProviderRegistry, 350);
private static readonly _requests = new LRUCache<string, { promiseCnt: number, source: CancellationTokenSource, promise: Promise<any>, model: OutlineModel | undefined }>(9, 0.75);
private static readonly _keys = new class {
@ -252,13 +252,7 @@ export class OutlineModel extends TreeElement {
// keep moving average of request durations
const now = Date.now();
data.promise.then(() => {
let key = this._keys.for(textModel, false);
let avg = this._requestDurations.get(key);
if (!avg) {
avg = new MovingAverage();
this._requestDurations.set(key, avg);
}
avg.update(Date.now() - now);
this._requestDurations.update(textModel, Date.now() - now);
});
}
@ -290,14 +284,7 @@ export class OutlineModel extends TreeElement {
}
static getRequestDelay(textModel: ITextModel | null): number {
if (!textModel) {
return 350;
}
const avg = this._requestDurations.get(this._keys.for(textModel, false));
if (!avg) {
return 350;
}
return Math.max(350, Math.floor(1.3 * avg.value));
return textModel ? this._requestDurations.get(textModel) : this._requestDurations.min;
}
private static _create(textModel: ITextModel, token: CancellationToken): Promise<OutlineModel> {

View file

@ -57,7 +57,7 @@ class MessageWidget {
domNode.className = 'descriptioncontainer';
this._messageBlock = document.createElement('div');
dom.addClass(this._messageBlock, 'message');
this._messageBlock.classList.add('message');
this._messageBlock.setAttribute('aria-live', 'assertive');
this._messageBlock.setAttribute('role', 'alert');
domNode.appendChild(this._messageBlock);
@ -123,19 +123,19 @@ class MessageWidget {
}
if (source || code) {
const detailsElement = document.createElement('span');
dom.addClass(detailsElement, 'details');
detailsElement.classList.add('details');
lastLineElement.appendChild(detailsElement);
if (source) {
const sourceElement = document.createElement('span');
sourceElement.innerText = source;
dom.addClass(sourceElement, 'source');
sourceElement.classList.add('source');
detailsElement.appendChild(sourceElement);
}
if (code) {
if (typeof code === 'string') {
const codeElement = document.createElement('span');
codeElement.innerText = `(${code})`;
dom.addClass(codeElement, 'code');
codeElement.classList.add('code');
detailsElement.appendChild(codeElement);
} else {
this._codeLink = dom.$('a.code-link');
@ -166,7 +166,7 @@ class MessageWidget {
let container = document.createElement('div');
let relatedResource = document.createElement('a');
dom.addClass(relatedResource, 'filename');
relatedResource.classList.add('filename');
relatedResource.innerText = `${getBaseLabel(related.resource)}(${related.startLineNumber}, ${related.startColumn}): `;
relatedResource.title = getPathLabel(related.resource, undefined);
this._relatedDiagnostics.set(relatedResource, related);
@ -318,7 +318,7 @@ export class MarkerNavigationWidget extends PeekViewWidget {
protected _fillBody(container: HTMLElement): void {
this._parentContainer = container;
dom.addClass(container, 'marker-widget');
container.classList.add('marker-widget');
this._parentContainer.tabIndex = 0;
this._parentContainer.setAttribute('role', 'tooltip');

View file

@ -5,7 +5,7 @@
import * as nls from 'vs/nls';
import { onUnexpectedError } from 'vs/base/common/errors';
import { dispose, DisposableStore } from 'vs/base/common/lifecycle';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { IContextKey, IContextKeyService, RawContextKey, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
@ -64,8 +64,8 @@ export abstract class ReferencesController implements IEditorContribution {
dispose(): void {
this._referenceSearchVisible.reset();
this._disposables.dispose();
dispose(this._widget);
dispose(this._model);
this._widget?.dispose();
this._model?.dispose();
this._widget = undefined;
this._model = undefined;
}
@ -226,8 +226,8 @@ export abstract class ReferencesController implements IEditorContribution {
}
closeWidget(focusEditor = true): void {
dispose(this._widget);
dispose(this._model);
this._widget?.dispose();
this._model?.dispose();
this._referenceSearchVisible.reset();
this._disposables.clear();
this._widget = undefined;

View file

@ -55,8 +55,8 @@ class SymbolNavigationService implements ISymbolNavigationService {
reset(): void {
this._ctxHasSymbols.reset();
dispose(this._currentState);
dispose(this._currentMessage);
this._currentState?.dispose();
this._currentMessage?.dispose();
this._currentModel = undefined;
this._currentIdx = -1;
}
@ -138,7 +138,7 @@ class SymbolNavigationService implements ISymbolNavigationService {
private _showMessage(): void {
dispose(this._currentMessage);
this._currentMessage?.dispose();
const kb = this._keybindingService.lookupKeybinding('editor.gotoNextSymbolFromResult');
const message = kb
@ -209,7 +209,7 @@ class EditorState {
}
private _onDidRemoveEditor(editor: ICodeEditor): void {
dispose(this._listener.get(editor));
this._listener.get(editor)?.dispose();
this._listener.delete(editor);
}
}

View file

@ -240,11 +240,11 @@ export class ModesContentHoverWidget extends ContentHoverWidget {
this._register(dom.addStandardDisposableListener(this.getDomNode(), dom.EventType.FOCUS, () => {
if (this._colorPicker) {
dom.addClass(this.getDomNode(), 'colorpicker-hover');
this.getDomNode().classList.add('colorpicker-hover');
}
}));
this._register(dom.addStandardDisposableListener(this.getDomNode(), dom.EventType.BLUR, () => {
dom.removeClass(this.getDomNode(), 'colorpicker-hover');
this.getDomNode().classList.remove('colorpicker-hover');
}));
this._register(editor.onDidChangeConfiguration((e) => {
this._hoverOperation.setHoverTime(this._editor.getOption(EditorOption.hover).delay);

View file

@ -15,9 +15,10 @@ import { registerEditorContribution, EditorCommand, registerEditorCommand } from
import { ICodeEditor, IContentWidget, IContentWidgetPosition, ContentWidgetPositionPreference } from 'vs/editor/browser/editorBrowser';
import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { IPosition } from 'vs/editor/common/core/position';
import { registerThemingParticipant, HIGH_CONTRAST } from 'vs/platform/theme/common/themeService';
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { inputValidationInfoBorder, inputValidationInfoBackground, inputValidationInfoForeground } from 'vs/platform/theme/common/colorRegistry';
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { ColorScheme } from 'vs/platform/theme/common/theme';
export class MessageController extends Disposable implements IEditorContribution {
@ -184,7 +185,7 @@ registerEditorContribution(MessageController.ID, MessageController);
registerThemingParticipant((theme, collector) => {
const border = theme.getColor(inputValidationInfoBorder);
if (border) {
let borderWidth = theme.type === HIGH_CONTRAST ? 2 : 1;
let borderWidth = theme.type === ColorScheme.HIGH_CONTRAST ? 2 : 1;
collector.addRule(`.monaco-editor .monaco-editor-overlaymessage .anchor { border-top-color: ${border}; }`);
collector.addRule(`.monaco-editor .monaco-editor-overlaymessage .message { border: ${borderWidth}px solid ${border}; }`);
}

View file

@ -20,11 +20,12 @@ import * as nls from 'vs/nls';
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { editorHoverBackground, editorHoverBorder, textCodeBlockBackground, textLinkForeground, editorHoverForeground } from 'vs/platform/theme/common/colorRegistry';
import { HIGH_CONTRAST, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { ParameterHintsModel, TriggerContext } from 'vs/editor/contrib/parameterHints/parameterHintsModel';
import { pad } from 'vs/base/common/strings';
import { registerIcon, Codicon } from 'vs/base/common/codicons';
import { assertIsDefined } from 'vs/base/common/types';
import { ColorScheme } from 'vs/platform/theme/common/theme';
const $ = dom.$;
@ -364,7 +365,7 @@ export class ParameterHintsWidget extends Disposable implements IContentWidget {
registerThemingParticipant((theme, collector) => {
const border = theme.getColor(editorHoverBorder);
if (border) {
const borderWidth = theme.type === HIGH_CONTRAST ? 2 : 1;
const borderWidth = theme.type === ColorScheme.HIGH_CONTRAST ? 2 : 1;
collector.addRule(`.monaco-editor .parameter-hints-widget { border: ${borderWidth}px solid ${border}; }`);
collector.addRule(`.monaco-editor .parameter-hints-widget.multiple .body { border-left: 1px solid ${border.transparent(0.5)}; }`);
collector.addRule(`.monaco-editor .parameter-hints-widget .signature.has-docs { border-bottom: 1px solid ${border.transparent(0.5)}; }`);

View file

@ -18,7 +18,7 @@ import * as modes from 'vs/editor/common/modes';
import * as nls from 'vs/nls';
import { MenuId } from 'vs/platform/actions/common/actions';
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IDisposable } from 'vs/base/common/lifecycle';
import { WordSelectionRangeProvider } from 'vs/editor/contrib/smartSelect/wordSelections';
import { BracketSelectionRangeProvider } from 'vs/editor/contrib/smartSelect/bracketSelections';
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
@ -64,7 +64,7 @@ class SmartSelectController implements IEditorContribution {
}
dispose(): void {
dispose(this._selectionListener);
this._selectionListener?.dispose();
}
run(forward: boolean): Promise<void> | void {
@ -106,10 +106,10 @@ class SmartSelectController implements IEditorContribution {
this._state = ranges.map(ranges => new SelectionRanges(0, ranges));
// listen to caret move and forget about state
dispose(this._selectionListener);
this._selectionListener?.dispose();
this._selectionListener = this._editor.onDidChangeCursorPosition(() => {
if (!this._ignoreSelection) {
dispose(this._selectionListener);
this._selectionListener?.dispose();
this._state = undefined;
}
});

View file

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { dispose, DisposableStore } from 'vs/base/common/lifecycle';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { EditorCommand, registerEditorCommand, registerEditorContribution } from 'vs/editor/browser/editorExtensions';
import { Range } from 'vs/editor/common/core/range';
@ -75,7 +75,7 @@ export class SnippetController2 implements IEditorContribution {
this._inSnippet.reset();
this._hasPrevTabstop.reset();
this._hasNextTabstop.reset();
dispose(this._session);
this._session?.dispose();
this._snippetListener.dispose();
}
@ -211,7 +211,7 @@ export class SnippetController2 implements IEditorContribution {
this._hasPrevTabstop.reset();
this._hasNextTabstop.reset();
this._snippetListener.clear();
dispose(this._session);
this._session?.dispose();
this._session = undefined;
this._modelVersionId = -1;
if (resetSelection) {

View file

@ -351,6 +351,7 @@
box-sizing: border-box;
height: 100%;
width: 100%;
padding-right: 22px;
}
.monaco-editor .suggest-widget .details > .monaco-scrollable-element > .body > .header > .type {

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import { IDisposable } from 'vs/base/common/lifecycle';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import { CompletionModel } from './completionModel';
@ -34,7 +34,7 @@ export class SuggestAlternatives {
reset(): void {
this._ckOtherSuggestions.reset();
dispose(this._listener);
this._listener?.dispose();
this._model = undefined;
this._acceptNext = undefined;
this._ignore = false;

View file

@ -598,7 +598,8 @@ export class TriggerSuggestAction extends EditorAction {
kbOpts: {
kbExpr: EditorContextKeys.textInputFocus,
primary: KeyMod.CtrlCmd | KeyCode.Space,
mac: { primary: KeyMod.WinCtrl | KeyCode.Space, secondary: [KeyMod.Alt | KeyCode.Escape] },
secondary: [KeyMod.CtrlCmd | KeyCode.KEY_I],
mac: { primary: KeyMod.WinCtrl | KeyCode.Space, secondary: [KeyMod.Alt | KeyCode.Escape, KeyMod.CtrlCmd | KeyCode.KEY_I] },
weight: KeybindingWeight.EditorContrib
}
});

View file

@ -436,7 +436,7 @@ export class SuggestModel implements IDisposable {
Promise.all([completions, wordDistance]).then(async ([completions, wordDistance]) => {
dispose(this._requestToken);
this._requestToken?.dispose();
if (this._state === State.Idle) {
return;

View file

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { RawContextKey, IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { IDisposable, dispose, Disposable } from 'vs/base/common/lifecycle';
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { EditorOption } from 'vs/editor/common/config/editorOptions';
@ -29,7 +29,7 @@ export class WordContextKey extends Disposable {
dispose(): void {
super.dispose();
dispose(this._selectionListener);
this._selectionListener?.dispose();
this._ckAtEnd.reset();
}

View file

@ -20,8 +20,9 @@ import { NULL_STATE, nullTokenize, nullTokenize2 } from 'vs/editor/common/modes/
import { IModeService } from 'vs/editor/common/services/modeService';
import { IStandaloneThemeService } from 'vs/editor/standalone/common/standaloneThemeService';
import { editorHoverBackground, editorHoverBorder, editorHoverForeground } from 'vs/platform/theme/common/colorRegistry';
import { HIGH_CONTRAST, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { InspectTokensNLS } from 'vs/editor/common/standaloneStrings';
import { ColorScheme } from 'vs/platform/theme/common/theme';
class InspectTokensController extends Disposable implements IEditorContribution {
@ -332,7 +333,7 @@ registerEditorAction(InspectTokens);
registerThemingParticipant((theme, collector) => {
const border = theme.getColor(editorHoverBorder);
if (border) {
let borderWidth = theme.type === HIGH_CONTRAST ? 2 : 1;
let borderWidth = theme.type === ColorScheme.HIGH_CONTRAST ? 2 : 1;
collector.addRule(`.monaco-editor .tokens-inspect-widget { border: ${borderWidth}px solid ${border}; }`);
collector.addRule(`.monaco-editor .tokens-inspect-widget .tokens-inspect-separator { background-color: ${border}; }`);
}

View file

@ -15,6 +15,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
import { ColorIdentifier, Extensions, IColorRegistry } from 'vs/platform/theme/common/colorRegistry';
import { Extensions as ThemingExtensions, ICssStyleCollector, IFileIconTheme, IThemingRegistry, ITokenStyle } from 'vs/platform/theme/common/themeService';
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
import { ColorScheme } from 'vs/platform/theme/common/theme';
const VS_THEME_NAME = 'vs';
const VS_DARK_THEME_NAME = 'vs-dark';
@ -107,11 +108,11 @@ class StandaloneTheme implements IStandaloneTheme {
return Object.prototype.hasOwnProperty.call(this.getColors(), colorId);
}
public get type() {
public get type(): ColorScheme {
switch (this.base) {
case VS_THEME_NAME: return 'light';
case HC_BLACK_THEME_NAME: return 'hc';
default: return 'dark';
case VS_THEME_NAME: return ColorScheme.LIGHT;
case HC_BLACK_THEME_NAME: return ColorScheme.HIGH_CONTRAST;
default: return ColorScheme.DARK;
}
}

View file

@ -12,7 +12,8 @@ import { TokenTheme } from 'vs/editor/common/modes/supports/tokenization';
import { ILineTokens, IToken, TokenizationSupport2Adapter, TokensProvider } from 'vs/editor/standalone/browser/standaloneLanguages';
import { IStandaloneTheme, IStandaloneThemeData, IStandaloneThemeService } from 'vs/editor/standalone/common/standaloneThemeService';
import { ColorIdentifier } from 'vs/platform/theme/common/colorRegistry';
import { IFileIconTheme, IColorTheme, LIGHT, ITokenStyle } from 'vs/platform/theme/common/themeService';
import { ColorScheme } from 'vs/platform/theme/common/theme';
import { IFileIconTheme, IColorTheme, ITokenStyle } from 'vs/platform/theme/common/themeService';
suite('TokenizationSupport2Adapter', () => {
@ -46,9 +47,9 @@ suite('TokenizationSupport2Adapter', () => {
tokenTheme: new MockTokenTheme(),
themeName: LIGHT,
themeName: ColorScheme.LIGHT,
type: LIGHT,
type: ColorScheme.LIGHT,
getColor: (color: ColorIdentifier, useDefault?: boolean): Color => {
throw new Error('Not implemented');

View file

@ -42,7 +42,7 @@ export class BackupMainService implements IBackupMainService {
@IConfigurationService private readonly configurationService: IConfigurationService,
@ILogService private readonly logService: ILogService
) {
this.backupHome = environmentService.backupHome.fsPath;
this.backupHome = environmentService.backupHome;
this.workspacesJsonPath = environmentService.backupWorkspacesPath;
}

View file

@ -5,9 +5,10 @@
import { Event } from 'vs/base/common/event';
import { MessageBoxOptions, MessageBoxReturnValue, OpenDevToolsOptions, SaveDialogOptions, OpenDialogOptions, OpenDialogReturnValue, SaveDialogReturnValue, MouseInputEvent } from 'vs/base/parts/sandbox/common/electronTypes';
import { IOpenedWindow, IWindowOpenable, IOpenEmptyWindowOptions, IOpenWindowOptions, ColorScheme } from 'vs/platform/windows/common/windows';
import { IOpenedWindow, IWindowOpenable, IOpenEmptyWindowOptions, IOpenWindowOptions } from 'vs/platform/windows/common/windows';
import { INativeOpenDialogOptions } from 'vs/platform/dialogs/common/dialogs';
import { ISerializableCommandAction } from 'vs/platform/actions/common/actions';
import { ColorScheme } from 'vs/platform/theme/common/theme';
export interface IOSProperties {
type: string;

View file

@ -8,7 +8,7 @@ import { IWindowsMainService, ICodeWindow } from 'vs/platform/windows/electron-m
import { MessageBoxOptions, MessageBoxReturnValue, shell, OpenDevToolsOptions, SaveDialogOptions, SaveDialogReturnValue, OpenDialogOptions, OpenDialogReturnValue, Menu, BrowserWindow, app, clipboard, powerMonitor, nativeTheme } from 'electron';
import { OpenContext } from 'vs/platform/windows/node/window';
import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
import { IOpenedWindow, IOpenWindowOptions, IWindowOpenable, IOpenEmptyWindowOptions, ColorScheme } from 'vs/platform/windows/common/windows';
import { IOpenedWindow, IOpenWindowOptions, IWindowOpenable, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows';
import { INativeOpenDialogOptions } from 'vs/platform/dialogs/common/dialogs';
import { isMacintosh, isWindows, isRootUser } from 'vs/base/common/platform';
import { ICommonElectronService, IOSProperties } from 'vs/platform/electron/common/electron';
@ -22,6 +22,7 @@ import { ITelemetryData, ITelemetryService } from 'vs/platform/telemetry/common/
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { MouseInputEvent } from 'vs/base/parts/sandbox/common/electronTypes';
import { arch, totalmem, release, platform, type } from 'os';
import { ColorScheme } from 'vs/platform/theme/common/theme';
export interface IElectronMainService extends AddFirstParameterToFunctions<ICommonElectronService, Promise<unknown> /* only methods, not events */, number | undefined /* window ID */> { }
@ -45,11 +46,13 @@ export class ElectronMainService implements IElectronMainService {
// Color Scheme changes
nativeTheme.on('updated', () => {
let colorScheme = ColorScheme.DEFAULT;
let colorScheme: ColorScheme;
if (nativeTheme.shouldUseInvertedColorScheme || nativeTheme.shouldUseHighContrastColors) {
colorScheme = ColorScheme.HIGH_CONTRAST;
} else if (nativeTheme.shouldUseDarkColors) {
colorScheme = ColorScheme.DARK;
} else {
colorScheme = ColorScheme.LIGHT;
}
this._onColorSchemeChange.fire(colorScheme);

View file

@ -18,8 +18,6 @@ export interface IExtensionHostDebugParams extends IDebugParams {
debugId?: string;
}
export const BACKUPS = 'Backups';
/**
* A basic environment service that can be used in various processes,
* such as main, renderer and shared process. Use subclasses of this
@ -44,7 +42,6 @@ export interface IEnvironmentService {
snippetsHome: URI;
// --- data paths
backupHome: URI;
untitledWorkspacesHome: URI;
globalStorageHome: URI;
@ -100,6 +97,7 @@ export interface INativeEnvironmentService extends IEnvironmentService {
appSettingsHome: URI;
userDataPath: string;
machineSettingsResource: URI;
backupHome: string;
backupWorkspacesPath: string;
nodeCachedDataDir?: string;
installSourcePath: string;

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IDebugParams, IExtensionHostDebugParams, BACKUPS, INativeEnvironmentService } from 'vs/platform/environment/common/environment';
import { IDebugParams, IExtensionHostDebugParams, INativeEnvironmentService } from 'vs/platform/environment/common/environment';
import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
import * as crypto from 'crypto';
import * as paths from 'vs/base/node/paths';
@ -94,10 +94,10 @@ export class EnvironmentService implements INativeEnvironmentService {
get isExtensionDevelopment(): boolean { return !!this._args.extensionDevelopmentPath; }
@memoize
get backupHome(): URI { return URI.file(path.join(this.userDataPath, BACKUPS)); }
get backupHome(): string { return path.join(this.userDataPath, 'Backups'); }
@memoize
get backupWorkspacesPath(): string { return path.join(this.backupHome.fsPath, 'workspaces.json'); }
get backupWorkspacesPath(): string { return path.join(this.backupHome, 'workspaces.json'); }
@memoize
get untitledWorkspacesHome(): URI { return URI.file(path.join(this.userDataPath, 'Workspaces')); }

View file

@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
import { URI } from 'vs/base/common/uri';
import { endsWith } from 'vs/base/common/strings';
const SshProtocolMatcher = /^([^@:]+@)?([^:]+):/;
const SshUrlMatcher = /^([^@:]+@)?([^:]+):(.+)$/;
@ -76,7 +75,7 @@ function stripPort(authority: string): string | null {
function normalizeRemote(host: string | null, path: string, stripEndingDotGit: boolean): string | null {
if (host && path) {
if (stripEndingDotGit && endsWith(path, '.git')) {
if (stripEndingDotGit && path.endsWith('.git')) {
path = path.substr(0, path.length - 4);
}
return (path.indexOf('/') === 0) ? `${host}${path}` : `${host}/${path}`;

View file

@ -6,7 +6,7 @@
import { getErrorMessage, isPromiseCanceledError, canceled } from 'vs/base/common/errors';
import { StatisticType, IGalleryExtension, IExtensionGalleryService, IGalleryExtensionAsset, IQueryOptions, SortBy, SortOrder, IExtensionIdentifier, IReportedExtension, InstallOperation, ITranslation, IGalleryExtensionVersion, IGalleryExtensionAssets, isIExtensionIdentifier, DefaultIconPath } from 'vs/platform/extensionManagement/common/extensionManagement';
import { getGalleryExtensionId, getGalleryExtensionTelemetryData, adoptToGalleryExtensionId } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
import { assign, getOrDefault } from 'vs/base/common/objects';
import { getOrDefault } from 'vs/base/common/objects';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IPager } from 'vs/base/common/paging';
import { IRequestService, asJson, asText } from 'vs/platform/request/common/request';
@ -158,7 +158,7 @@ class Query {
get flags(): number { return this.state.flags; }
withPage(pageNumber: number, pageSize: number = this.state.pageSize): Query {
return new Query(assign({}, this.state, { pageNumber, pageSize }));
return new Query({ ...this.state, pageNumber, pageSize });
}
withFilter(filterType: FilterType, ...values: string[]): Query {
@ -167,23 +167,23 @@ class Query {
...values.length ? values.map(value => ({ filterType, value })) : [{ filterType }]
];
return new Query(assign({}, this.state, { criteria }));
return new Query({ ...this.state, criteria });
}
withSortBy(sortBy: SortBy): Query {
return new Query(assign({}, this.state, { sortBy }));
return new Query({ ...this.state, sortBy });
}
withSortOrder(sortOrder: SortOrder): Query {
return new Query(assign({}, this.state, { sortOrder }));
return new Query({ ...this.state, sortOrder });
}
withFlags(...flags: Flags[]): Query {
return new Query(assign({}, this.state, { flags: flags.reduce((r, f) => r | f, 0) }));
return new Query({ ...this.state, flags: flags.reduce<number>((r, f) => r | f, 0) });
}
withAssetTypes(...assetTypes: string[]): Query {
return new Query(assign({}, this.state, { assetTypes }));
return new Query({ ...this.state, assetTypes });
}
get raw(): any {
@ -381,10 +381,10 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
}
}
private getCompatibleExtensionByEngine(arg1: IExtensionIdentifier | IGalleryExtension, version?: string): Promise<IGalleryExtension | null> {
private async getCompatibleExtensionByEngine(arg1: IExtensionIdentifier | IGalleryExtension, version?: string): Promise<IGalleryExtension | null> {
const extension: IGalleryExtension | null = isIExtensionIdentifier(arg1) ? null : arg1;
if (extension && extension.properties.engine && isEngineValid(extension.properties.engine, this.productService.version)) {
return Promise.resolve(extension);
return extension;
}
const { id, uuid } = extension ? extension.identifier : <IExtensionIdentifier>arg1;
let query = new Query()
@ -398,40 +398,38 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
query = query.withFilter(FilterType.ExtensionName, id);
}
return this.queryGallery(query, CancellationToken.None)
.then(({ galleryExtensions }) => {
const [rawExtension] = galleryExtensions;
if (!rawExtension || !rawExtension.versions.length) {
return null;
const { galleryExtensions } = await this.queryGallery(query, CancellationToken.None);
const [rawExtension] = galleryExtensions;
if (!rawExtension || !rawExtension.versions.length) {
return null;
}
if (version) {
const versionAsset = rawExtension.versions.filter(v => v.version === version)[0];
if (versionAsset) {
const extension = toExtension(rawExtension, versionAsset, 0, query);
if (extension.properties.engine && isEngineValid(extension.properties.engine, this.productService.version)) {
return extension;
}
if (version) {
const versionAsset = rawExtension.versions.filter(v => v.version === version)[0];
if (versionAsset) {
const extension = toExtension(rawExtension, versionAsset, 0, query);
if (extension.properties.engine && isEngineValid(extension.properties.engine, this.productService.version)) {
return extension;
}
}
return null;
}
return this.getLastValidExtensionVersion(rawExtension, rawExtension.versions)
.then(rawVersion => {
if (rawVersion) {
return toExtension(rawExtension, rawVersion, 0, query);
}
return null;
});
});
}
return null;
}
const rawVersion = await this.getLastValidExtensionVersion(rawExtension, rawExtension.versions);
if (rawVersion) {
return toExtension(rawExtension, rawVersion, 0, query);
}
return null;
}
query(token: CancellationToken): Promise<IPager<IGalleryExtension>>;
query(options: IQueryOptions, token: CancellationToken): Promise<IPager<IGalleryExtension>>;
query(arg1: any, arg2?: any): Promise<IPager<IGalleryExtension>> {
async query(arg1: any, arg2?: any): Promise<IPager<IGalleryExtension>> {
const options: IQueryOptions = CancellationToken.isCancellationToken(arg1) ? {} : arg1;
const token: CancellationToken = CancellationToken.isCancellationToken(arg1) ? arg1 : arg2;
if (!this.isEnabled()) {
return Promise.reject(new Error('No extension gallery service configured.'));
throw new Error('No extension gallery service configured.');
}
const type = options.names ? 'ids' : (options.text ? 'text' : 'all');
@ -496,84 +494,80 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
query = query.withSortOrder(options.sortOrder);
}
return this.queryGallery(query, token).then(({ galleryExtensions, total }) => {
const extensions = galleryExtensions.map((e, index) => toExtension(e, e.versions[0], index, query, options.source));
const pageSize = query.pageSize;
const getPage = (pageIndex: number, ct: CancellationToken) => {
if (ct.isCancellationRequested) {
return Promise.reject(canceled());
}
const { galleryExtensions, total } = await this.queryGallery(query, token);
const extensions = galleryExtensions.map((e, index) => toExtension(e, e.versions[0], index, query, options.source));
const getPage = async (pageIndex: number, ct: CancellationToken) => {
if (ct.isCancellationRequested) {
throw canceled();
}
const nextPageQuery = query.withPage(pageIndex + 1);
const { galleryExtensions } = await this.queryGallery(nextPageQuery, ct);
return galleryExtensions.map((e, index) => toExtension(e, e.versions[0], index, nextPageQuery, options.source));
};
const nextPageQuery = query.withPage(pageIndex + 1);
return this.queryGallery(nextPageQuery, ct)
.then(({ galleryExtensions }) => galleryExtensions.map((e, index) => toExtension(e, e.versions[0], index, nextPageQuery, options.source)));
};
return { firstPage: extensions, total, pageSize, getPage } as IPager<IGalleryExtension>;
});
return { firstPage: extensions, total, pageSize: query.pageSize, getPage } as IPager<IGalleryExtension>;
}
private queryGallery(query: Query, token: CancellationToken): Promise<{ galleryExtensions: IRawGalleryExtension[], total: number; }> {
private async queryGallery(query: Query, token: CancellationToken): Promise<{ galleryExtensions: IRawGalleryExtension[], total: number; }> {
if (!this.isEnabled()) {
throw new Error('No extension gallery service configured.');
}
// Always exclude non validated and unpublished extensions
query = query
.withFlags(query.flags, Flags.ExcludeNonValidated)
.withFilter(FilterType.ExcludeWithFlags, flagsToString(Flags.Unpublished));
if (!this.isEnabled()) {
return Promise.reject(new Error('No extension gallery service configured.'));
const commonHeaders = await this.commonHeadersPromise;
const data = JSON.stringify(query.raw);
const headers = {
...commonHeaders,
'Content-Type': 'application/json',
'Accept': 'application/json;api-version=3.0-preview.1',
'Accept-Encoding': 'gzip',
'Content-Length': String(data.length)
};
const context = await this.requestService.request({
type: 'POST',
url: this.api('/extensionquery'),
data,
headers
}, token);
if (context.res.statusCode && context.res.statusCode >= 400 && context.res.statusCode < 500) {
return { galleryExtensions: [], total: 0 };
}
return this.commonHeadersPromise.then(commonHeaders => {
const data = JSON.stringify(query.raw);
const headers = assign({}, commonHeaders, {
'Content-Type': 'application/json',
'Accept': 'application/json;api-version=3.0-preview.1',
'Accept-Encoding': 'gzip',
'Content-Length': data.length
});
return this.requestService.request({
type: 'POST',
url: this.api('/extensionquery'),
data,
headers
}, token).then(context => {
const result = await asJson<IRawGalleryQueryResult>(context);
if (result) {
const r = result.results[0];
const galleryExtensions = r.extensions;
const resultCount = r.resultMetadata && r.resultMetadata.filter(m => m.metadataType === 'ResultCount')[0];
const total = resultCount && resultCount.metadataItems.filter(i => i.name === 'TotalCount')[0].count || 0;
if (context.res.statusCode && context.res.statusCode >= 400 && context.res.statusCode < 500) {
return { galleryExtensions: [], total: 0 };
}
return asJson<IRawGalleryQueryResult>(context).then(result => {
if (result) {
const r = result.results[0];
const galleryExtensions = r.extensions;
const resultCount = r.resultMetadata && r.resultMetadata.filter(m => m.metadataType === 'ResultCount')[0];
const total = resultCount && resultCount.metadataItems.filter(i => i.name === 'TotalCount')[0].count || 0;
return { galleryExtensions, total };
}
return { galleryExtensions: [], total: 0 };
});
});
});
return { galleryExtensions, total };
}
return { galleryExtensions: [], total: 0 };
}
reportStatistic(publisher: string, name: string, version: string, type: StatisticType): Promise<void> {
async reportStatistic(publisher: string, name: string, version: string, type: StatisticType): Promise<void> {
if (!this.isEnabled()) {
return Promise.resolve(undefined);
return undefined;
}
return this.commonHeadersPromise.then(commonHeaders => {
const headers = { ...commonHeaders, Accept: '*/*;api-version=4.0-preview.1' };
return this.requestService.request({
const commonHeaders = await this.commonHeadersPromise;
const headers = { ...commonHeaders, Accept: '*/*;api-version=4.0-preview.1' };
try {
await this.requestService.request({
type: 'POST',
url: this.api(`/publishers/${publisher}/extensions/${name}/${version}/stats?statType=${type}`),
headers
}, CancellationToken.None).then(undefined, () => undefined);
});
}, CancellationToken.None);
} catch (error) { /* Ignore */ }
}
download(extension: IGalleryExtension, location: URI, operation: InstallOperation): Promise<void> {
async download(extension: IGalleryExtension, location: URI, operation: InstallOperation): Promise<void> {
this.logService.trace('ExtensionGalleryService#download', extension.identifier.id);
const data = getGalleryExtensionTelemetryData(extension);
const startTime = new Date().getTime();
@ -585,7 +579,7 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
]
}
*/
const log = (duration: number) => this.telemetryService.publicLog('galleryService:downloadVSIX', assign(data, { duration }));
const log = (duration: number) => this.telemetryService.publicLog('galleryService:downloadVSIX', { ...data, duration });
const operationParam = operation === InstallOperation.Install ? 'install' : operation === InstallOperation.Update ? 'update' : '';
const downloadAsset = operationParam ? {
@ -593,46 +587,46 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
fallbackUri: `${extension.assets.download.fallbackUri}?${operationParam}=true`
} : extension.assets.download;
return this.getAsset(downloadAsset)
.then(context => this.fileService.writeFile(location, context.stream))
.then(() => log(new Date().getTime() - startTime));
const context = await this.getAsset(downloadAsset);
await this.fileService.writeFile(location, context.stream);
log(new Date().getTime() - startTime);
}
getReadme(extension: IGalleryExtension, token: CancellationToken): Promise<string> {
async getReadme(extension: IGalleryExtension, token: CancellationToken): Promise<string> {
if (extension.assets.readme) {
return this.getAsset(extension.assets.readme, {}, token)
.then(context => asText(context))
.then(content => content || '');
const context = await this.getAsset(extension.assets.readme, {}, token);
const content = await asText(context);
return content || '';
}
return Promise.resolve('');
return '';
}
getManifest(extension: IGalleryExtension, token: CancellationToken): Promise<IExtensionManifest | null> {
async getManifest(extension: IGalleryExtension, token: CancellationToken): Promise<IExtensionManifest | null> {
if (extension.assets.manifest) {
return this.getAsset(extension.assets.manifest, {}, token)
.then(asText)
.then(text => text ? JSON.parse(text) : null);
const context = await this.getAsset(extension.assets.manifest, {}, token);
const text = await asText(context);
return text ? JSON.parse(text) : null;
}
return Promise.resolve(null);
return null;
}
getCoreTranslation(extension: IGalleryExtension, languageId: string): Promise<ITranslation | null> {
async getCoreTranslation(extension: IGalleryExtension, languageId: string): Promise<ITranslation | null> {
const asset = extension.assets.coreTranslations.filter(t => t[0] === languageId.toUpperCase())[0];
if (asset) {
return this.getAsset(asset[1])
.then(asText)
.then(text => text ? JSON.parse(text) : null);
const context = await this.getAsset(asset[1]);
const text = await asText(context);
return text ? JSON.parse(text) : null;
}
return Promise.resolve(null);
return null;
}
getChangelog(extension: IGalleryExtension, token: CancellationToken): Promise<string> {
async getChangelog(extension: IGalleryExtension, token: CancellationToken): Promise<string> {
if (extension.assets.changelog) {
return this.getAsset(extension.assets.changelog, {}, token)
.then(context => asText(context))
.then(content => content || '');
const context = await this.getAsset(extension.assets.changelog, {}, token);
const content = await asText(context);
return content || '';
}
return Promise.resolve('');
return '';
}
async getAllVersions(extension: IGalleryExtension, compatible: boolean): Promise<IGalleryExtensionVersion[]> {
@ -667,48 +661,45 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
return result;
}
private getAsset(asset: IGalleryExtensionAsset, options: IRequestOptions = {}, token: CancellationToken = CancellationToken.None): Promise<IRequestContext> {
return this.commonHeadersPromise.then(commonHeaders => {
const baseOptions = { type: 'GET' };
const headers = assign({}, commonHeaders, options.headers || {});
options = assign({}, options, baseOptions, { headers });
private async getAsset(asset: IGalleryExtensionAsset, options: IRequestOptions = {}, token: CancellationToken = CancellationToken.None): Promise<IRequestContext> {
const commonHeaders = await this.commonHeadersPromise;
const baseOptions = { type: 'GET' };
const headers = { ...commonHeaders, ...(options.headers || {}) };
options = { ...options, ...baseOptions, headers };
const url = asset.uri;
const fallbackUrl = asset.fallbackUri;
const firstOptions = assign({}, options, { url });
const url = asset.uri;
const fallbackUrl = asset.fallbackUri;
const firstOptions = { ...options, url };
return this.requestService.request(firstOptions, token)
.then(context => {
if (context.res.statusCode === 200) {
return Promise.resolve(context);
}
try {
const context = await this.requestService.request(firstOptions, token);
if (context.res.statusCode === 200) {
return context;
}
const message = await asText(context);
throw new Error(`Expected 200, got back ${context.res.statusCode} instead.\n\n${message}`);
} catch (err) {
if (isPromiseCanceledError(err)) {
throw err;
}
return asText(context)
.then(message => Promise.reject(new Error(`Expected 200, got back ${context.res.statusCode} instead.\n\n${message}`)));
})
.then(undefined, err => {
if (isPromiseCanceledError(err)) {
return Promise.reject(err);
}
const message = getErrorMessage(err);
type GalleryServiceCDNFallbackClassification = {
url: { classification: 'SystemMetaData', purpose: 'FeatureInsight' };
message: { classification: 'SystemMetaData', purpose: 'FeatureInsight' };
};
type GalleryServiceCDNFallbackEvent = {
url: string;
message: string;
};
this.telemetryService.publicLog2<GalleryServiceCDNFallbackEvent, GalleryServiceCDNFallbackClassification>('galleryService:cdnFallback', { url, message });
const message = getErrorMessage(err);
type GalleryServiceCDNFallbackClassification = {
url: { classification: 'SystemMetaData', purpose: 'FeatureInsight' };
message: { classification: 'SystemMetaData', purpose: 'FeatureInsight' };
};
type GalleryServiceCDNFallbackEvent = {
url: string;
message: string;
};
this.telemetryService.publicLog2<GalleryServiceCDNFallbackEvent, GalleryServiceCDNFallbackClassification>('galleryService:cdnFallback', { url, message });
const fallbackOptions = assign({}, options, { url: fallbackUrl });
return this.requestService.request(fallbackOptions, token);
});
});
const fallbackOptions = { ...options, url: fallbackUrl };
return this.requestService.request(fallbackOptions, token);
}
}
private getLastValidExtensionVersion(extension: IRawGalleryExtension, versions: IRawGalleryExtensionVersion[]): Promise<IRawGalleryExtensionVersion | null> {
private async getLastValidExtensionVersion(extension: IRawGalleryExtension, versions: IRawGalleryExtensionVersion[]): Promise<IRawGalleryExtensionVersion | null> {
const version = this.getLastValidExtensionVersionFromProperties(extension, versions);
if (version) {
return version;
@ -716,82 +707,82 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
return this.getLastValidExtensionVersionRecursively(extension, versions);
}
private getLastValidExtensionVersionFromProperties(extension: IRawGalleryExtension, versions: IRawGalleryExtensionVersion[]): Promise<IRawGalleryExtensionVersion> | null {
private getLastValidExtensionVersionFromProperties(extension: IRawGalleryExtension, versions: IRawGalleryExtensionVersion[]): IRawGalleryExtensionVersion | null {
for (const version of versions) {
const engine = getEngine(version);
if (!engine) {
return null;
}
if (isEngineValid(engine, this.productService.version)) {
return Promise.resolve(version);
return version;
}
}
return null;
}
private getEngine(version: IRawGalleryExtensionVersion): Promise<string> {
private async getEngine(version: IRawGalleryExtensionVersion): Promise<string> {
const engine = getEngine(version);
if (engine) {
return Promise.resolve(engine);
return engine;
}
const manifest = getVersionAsset(version, AssetType.Manifest);
if (!manifest) {
return Promise.reject('Manifest was not found');
const manifestAsset = getVersionAsset(version, AssetType.Manifest);
if (!manifestAsset) {
throw new Error('Manifest was not found');
}
const headers = { 'Accept-Encoding': 'gzip' };
return this.getAsset(manifest, { headers })
.then(context => asJson<IExtensionManifest>(context))
.then(manifest => manifest ? manifest.engines.vscode : Promise.reject<string>('Error while reading manifest'));
const context = await this.getAsset(manifestAsset, { headers });
const manifest = await asJson<IExtensionManifest>(context);
if (manifest) {
return manifest.engines.vscode;
}
throw new Error('Error while reading manifest');
}
private getLastValidExtensionVersionRecursively(extension: IRawGalleryExtension, versions: IRawGalleryExtensionVersion[]): Promise<IRawGalleryExtensionVersion | null> {
private async getLastValidExtensionVersionRecursively(extension: IRawGalleryExtension, versions: IRawGalleryExtensionVersion[]): Promise<IRawGalleryExtensionVersion | null> {
if (!versions.length) {
return Promise.resolve(null);
return null;
}
const version = versions[0];
return this.getEngine(version)
.then(engine => {
if (!isEngineValid(engine, this.productService.version)) {
return this.getLastValidExtensionVersionRecursively(extension, versions.slice(1));
}
const engine = await this.getEngine(version);
if (!isEngineValid(engine, this.productService.version)) {
return this.getLastValidExtensionVersionRecursively(extension, versions.slice(1));
}
version.properties = version.properties || [];
version.properties.push({ key: PropertyType.Engine, value: engine });
return version;
});
version.properties = version.properties || [];
version.properties.push({ key: PropertyType.Engine, value: engine });
return version;
}
getExtensionsReport(): Promise<IReportedExtension[]> {
async getExtensionsReport(): Promise<IReportedExtension[]> {
if (!this.isEnabled()) {
return Promise.reject(new Error('No extension gallery service configured.'));
throw new Error('No extension gallery service configured.');
}
if (!this.extensionsControlUrl) {
return Promise.resolve([]);
return [];
}
return this.requestService.request({ type: 'GET', url: this.extensionsControlUrl }, CancellationToken.None).then(context => {
if (context.res.statusCode !== 200) {
return Promise.reject(new Error('Could not get extensions report.'));
const context = await this.requestService.request({ type: 'GET', url: this.extensionsControlUrl }, CancellationToken.None);
if (context.res.statusCode !== 200) {
throw new Error('Could not get extensions report.');
}
const result = await asJson<IRawExtensionsReport>(context);
const map = new Map<string, IReportedExtension>();
if (result) {
for (const id of result.malicious) {
const ext = map.get(id) || { id: { id }, malicious: true, slow: false };
ext.malicious = true;
map.set(id, ext);
}
}
return asJson<IRawExtensionsReport>(context).then(result => {
const map = new Map<string, IReportedExtension>();
if (result) {
for (const id of result.malicious) {
const ext = map.get(id) || { id: { id }, malicious: true, slow: false };
ext.malicious = true;
map.set(id, ext);
}
}
return [...map.values()];
});
});
return [...map.values()];
}
}

View file

@ -6,7 +6,6 @@
import * as nls from 'vs/nls';
import * as path from 'vs/base/common/path';
import * as pfs from 'vs/base/node/pfs';
import { assign } from 'vs/base/common/objects';
import { toDisposable, Disposable } from 'vs/base/common/lifecycle';
import { isNonEmptyArray } from 'vs/base/common/arrays';
import { zip, IFile } from 'vs/base/node/zip';
@ -46,6 +45,7 @@ import { IExtensionManifest, ExtensionType } from 'vs/platform/extensions/common
import { ExtensionsDownloader } from 'vs/platform/extensionManagement/node/extensionDownloader';
import { ExtensionsScanner, IMetadata } from 'vs/platform/extensionManagement/node/extensionsScanner';
import { ExtensionsLifecycle } from 'vs/platform/extensionManagement/node/extensionLifecycle';
import { IStringDictionary } from 'vs/base/common/collections';
const INSTALL_ERROR_UNSET_UNINSTALLED = 'unsetUninstalled';
const INSTALL_ERROR_DOWNLOADING = 'downloading';
@ -677,7 +677,10 @@ export class ExtensionManagementService extends Disposable implements IExtension
private setUninstalled(...extensions: ILocalExtension[]): Promise<{ [id: string]: boolean }> {
const ids: ExtensionIdentifierWithVersion[] = extensions.map(e => new ExtensionIdentifierWithVersion(e.identifier, e.manifest.version));
return this.extensionsScanner.withUninstalledExtensions(uninstalled => assign(uninstalled, ids.reduce((result, id) => { result[id.key()] = true; return result; }, {} as { [id: string]: boolean })));
return this.extensionsScanner.withUninstalledExtensions(uninstalled => {
const newUninstalled = (ids.reduce<IStringDictionary<boolean>>((result, id) => { result[id.key()] = true; return result; }, {}));
return { ...uninstalled, ...newUninstalled };
});
}
private unsetUninstalled(extensionIdentifier: ExtensionIdentifierWithVersion): Promise<void> {
@ -745,6 +748,6 @@ export class ExtensionManagementService extends Disposable implements IExtension
]
}
*/
this.telemetryService.publicLogError(eventName, assign(extensionData, { success: !error, duration, errorcode }));
this.telemetryService.publicLogError(eventName, { ...extensionData, success: !error, duration, errorcode });
}
}

View file

@ -22,7 +22,7 @@ import { CancellationToken } from 'vscode';
import { extract, ExtractError } from 'vs/base/node/zip';
import { isWindows } from 'vs/base/common/platform';
import { flatten } from 'vs/base/common/arrays';
import { assign } from 'vs/base/common/objects';
import { IStringDictionary } from 'vs/base/common/collections';
const ERROR_SCANNING_SYS_EXTENSIONS = 'scanningSystem';
const ERROR_SCANNING_USER_EXTENSIONS = 'scanningUser';
@ -31,6 +31,7 @@ const INSTALL_ERROR_DELETING = 'deleting';
const INSTALL_ERROR_RENAMING = 'renaming';
export type IMetadata = Partial<IGalleryMetadata & { isMachineScoped: boolean; }>;
type ILocalExtensionManifest = IExtensionManifest & { __metadata?: IMetadata };
export class ExtensionsScanner extends Disposable {
@ -133,7 +134,7 @@ export class ExtensionsScanner extends Disposable {
const manifestPath = path.join(local.location.fsPath, 'package.json');
const raw = await pfs.readFile(manifestPath, 'utf8');
const { manifest } = await this.parseManifest(raw);
assign(manifest, { __metadata: metadata });
(manifest as ILocalExtensionManifest).__metadata = metadata;
await pfs.writeFile(manifestPath, JSON.stringify(manifest, null, '\t'));
return local;
}
@ -142,7 +143,7 @@ export class ExtensionsScanner extends Disposable {
return this.withUninstalledExtensions(uninstalled => uninstalled);
}
async withUninstalledExtensions<T>(fn: (uninstalled: { [id: string]: boolean; }) => T): Promise<T> {
async withUninstalledExtensions<T>(fn: (uninstalled: IStringDictionary<boolean>) => T): Promise<T> {
return this.uninstalledFileLimiter.queue(async () => {
let result: T | null = null;
return pfs.readFile(this.uninstalledPath, 'utf8')

View file

@ -5,7 +5,6 @@
import { IRequestOptions, IRequestContext } from 'vs/base/parts/request/common/request';
import { RequestService as NodeRequestService, IRawRequestFunction } from 'vs/platform/request/node/requestService';
import { assign } from 'vs/base/common/objects';
import { net } from 'electron';
import { CancellationToken } from 'vs/base/common/cancellation';
@ -16,6 +15,6 @@ function getRawRequest(options: IRequestOptions): IRawRequestFunction {
export class RequestMainService extends NodeRequestService {
request(options: IRequestOptions, token: CancellationToken): Promise<IRequestContext> {
return super.request(assign({}, options || {}, { getRawRequest }), token);
return super.request({ ...(options || {}), getRawRequest }, token);
}
}

View file

@ -9,7 +9,6 @@ import * as streams from 'vs/base/common/stream';
import { createGunzip } from 'zlib';
import { parse as parseUrl } from 'url';
import { Disposable } from 'vs/base/common/lifecycle';
import { assign } from 'vs/base/common/objects';
import { isBoolean, isNumber } from 'vs/base/common/types';
import { canceled } from 'vs/base/common/errors';
import { CancellationToken } from 'vs/base/common/cancellation';
@ -67,7 +66,10 @@ export class RequestService extends Disposable implements IRequestService {
options.strictSSL = strictSSL;
if (this.authorization) {
options.headers = assign(options.headers || {}, { 'Proxy-Authorization': this.authorization });
options.headers = {
...(options.headers || {}),
'Proxy-Authorization': this.authorization
};
}
return this._request(options, token);
@ -107,10 +109,11 @@ export class RequestService extends Disposable implements IRequestService {
req = rawRequest(opts, (res: http.IncomingMessage) => {
const followRedirects: number = isNumber(options.followRedirects) ? options.followRedirects : 3;
if (res.statusCode && res.statusCode >= 300 && res.statusCode < 400 && followRedirects > 0 && res.headers['location']) {
this._request(assign({}, options, {
this._request({
...options,
url: res.headers['location'],
followRedirects: followRedirects - 1
}), token).then(c, e);
}, token).then(c, e);
} else {
let stream: streams.ReadableStreamEvents<Uint8Array> = res;

View file

@ -0,0 +1,13 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* Color scheme used by the OS and by color themes.
*/
export enum ColorScheme {
DARK = 'dark',
LIGHT = 'light',
HIGH_CONTRAST = 'hc'
}

View file

@ -10,6 +10,7 @@ import * as platform from 'vs/platform/registry/common/platform';
import { ColorIdentifier } from 'vs/platform/theme/common/colorRegistry';
import { Event, Emitter } from 'vs/base/common/event';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { ColorScheme } from 'vs/platform/theme/common/theme';
export const IThemeService = createDecorator<IThemeService>('themeService');
@ -65,16 +66,10 @@ export namespace ThemeIcon {
export const FileThemeIcon = { id: 'file' };
export const FolderThemeIcon = { id: 'folder' };
// base themes
export const DARK: ThemeType = 'dark';
export const LIGHT: ThemeType = 'light';
export const HIGH_CONTRAST: ThemeType = 'hc';
export type ThemeType = 'light' | 'dark' | 'hc';
export function getThemeTypeSelector(type: ThemeType): string {
export function getThemeTypeSelector(type: ColorScheme): string {
switch (type) {
case DARK: return 'vs-dark';
case HIGH_CONTRAST: return 'hc-black';
case ColorScheme.DARK: return 'vs-dark';
case ColorScheme.HIGH_CONTRAST: return 'hc-black';
default: return 'vs';
}
}
@ -88,7 +83,7 @@ export interface ITokenStyle {
export interface IColorTheme {
readonly type: ThemeType;
readonly type: ColorScheme;
readonly label: string;

View file

@ -4,14 +4,15 @@
*--------------------------------------------------------------------------------------------*/
import { Event, Emitter } from 'vs/base/common/event';
import { IThemeService, IColorTheme, DARK, IFileIconTheme, ITokenStyle } from 'vs/platform/theme/common/themeService';
import { IThemeService, IColorTheme, IFileIconTheme, ITokenStyle } from 'vs/platform/theme/common/themeService';
import { Color } from 'vs/base/common/color';
import { ColorScheme } from 'vs/platform/theme/common/theme';
export class TestColorTheme implements IColorTheme {
public readonly label = 'test';
constructor(private colors: { [id: string]: string; } = {}, public type = DARK) {
constructor(private colors: { [id: string]: string; } = {}, public type = ColorScheme.DARK) {
}
getColor(color: string, useDefault?: boolean): Color | undefined {

View file

@ -6,7 +6,7 @@
import * as objects from 'vs/base/common/objects';
import { parse } from 'vs/base/common/json';
import { IUserFriendlyKeybinding } from 'vs/platform/keybinding/common/keybinding';
import { firstIndex as findFirstIndex, equals } from 'vs/base/common/arrays';
import { equals } from 'vs/base/common/arrays';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import * as contentUtil from 'vs/platform/userDataSync/common/content';
import { IStringDictionary } from 'vs/base/common/collections';
@ -346,7 +346,7 @@ function removeKeybindings(content: string, command: string, formattingOptions:
function updateKeybindings(content: string, command: string, keybindings: IUserFriendlyKeybinding[], formattingOptions: FormattingOptions): string {
const allKeybindings = parseKeybindings(content);
const location = findFirstIndex(allKeybindings, keybinding => keybinding.command === command || keybinding.command === `-${command}`);
const location = allKeybindings.findIndex(keybinding => keybinding.command === command || keybinding.command === `-${command}`);
// Remove all entries with this command
for (let index = allKeybindings.length - 1; index >= 0; index--) {
if (allKeybindings[index].command === command || allKeybindings[index].command === `-${command}`) {

View file

@ -10,7 +10,7 @@ import { IStringDictionary } from 'vs/base/common/collections';
import { FormattingOptions, Edit, getEOL } from 'vs/base/common/jsonFormatter';
import * as contentUtil from 'vs/platform/userDataSync/common/content';
import { IConflictSetting, getDisallowedIgnoredSettings } from 'vs/platform/userDataSync/common/userDataSync';
import { firstIndex, distinct } from 'vs/base/common/arrays';
import { distinct } from 'vs/base/common/arrays';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
export interface IMergeResult {
@ -320,7 +320,7 @@ interface InsertLocation {
function getInsertLocation(key: string, sourceTree: INode[], targetTree: INode[]): InsertLocation {
const sourceNodeIndex = firstIndex(sourceTree, (node => node.setting?.key === key));
const sourceNodeIndex = sourceTree.findIndex(node => node.setting?.key === key);
const sourcePreviousNode: INode = sourceTree[sourceNodeIndex - 1];
if (sourcePreviousNode) {

View file

@ -15,7 +15,6 @@ import { getServiceMachineId } from 'vs/platform/serviceMachineId/common/service
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IFileService } from 'vs/platform/files/common/files';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { assign } from 'vs/base/common/objects';
import { generateUuid } from 'vs/base/common/uuid';
import { isWeb } from 'vs/base/common/platform';
import { Emitter, Event } from 'vs/base/common/event';
@ -355,10 +354,12 @@ export class UserDataSyncStoreClient extends Disposable implements IUserDataSync
this.setDonotMakeRequestsUntil(undefined);
const commonHeaders = await this.commonHeadersPromise;
options.headers = assign(options.headers || {}, commonHeaders, {
options.headers = {
...(options.headers || {}),
...commonHeaders,
'X-Account-Type': this.authToken.type,
'authorization': `Bearer ${this.authToken.token}`,
});
};
// Add session headers
this.addSessionHeaders(options.headers);

View file

@ -11,6 +11,7 @@ import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier } from 'vs/platf
import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
import { LogLevel } from 'vs/platform/log/common/log';
import { ExportData } from 'vs/base/common/performance';
import { ColorScheme } from 'vs/platform/theme/common/theme';
export interface IBaseOpenWindowsOptions {
forceReuseWindow?: boolean;
@ -253,21 +254,3 @@ export interface INativeWindowConfiguration extends IWindowConfiguration, Native
export function zoomLevelToZoomFactor(zoomLevel = 0): number {
return Math.pow(1.2, zoomLevel);
}
export enum ColorScheme {
/**
* The window should use standard colors.
*/
DEFAULT = 1,
/**
* The window should use dark colors.
*/
DARK = 2,
/**
* The window should use high contrast colors.
*/
HIGH_CONTRAST = 3
}

View file

@ -1358,7 +1358,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
// For all other cases we first call into registerEmptyWindowBackupSync() to set it before
// loading the window.
if (options.emptyWindowBackupInfo) {
configuration.backupPath = join(this.environmentService.backupHome.fsPath, options.emptyWindowBackupInfo.backupFolder);
configuration.backupPath = join(this.environmentService.backupHome, options.emptyWindowBackupInfo.backupFolder);
}
let window: ICodeWindow | undefined;

40
src/vs/vscode.d.ts vendored
View file

@ -1160,7 +1160,7 @@ declare module 'vscode' {
revealRange(range: Range, revealType?: TextEditorRevealType): void;
/**
* ~~Show the text editor.~~
* Show the text editor.
*
* @deprecated Use [window.showTextDocument](#window.showTextDocument) instead.
*
@ -1170,7 +1170,7 @@ declare module 'vscode' {
show(column?: ViewColumn): void;
/**
* ~~Hide the text editor.~~
* Hide the text editor.
*
* @deprecated Use the command `workbench.action.closeActiveEditor` instead.
* This method shows unexpected behavior and will be removed in the next major update.
@ -2498,9 +2498,9 @@ declare module 'vscode' {
}
/**
* ~~MarkedString can be used to render human-readable text. It is either a markdown string
* MarkedString can be used to render human-readable text. It is either a markdown string
* or a code-block that provides a language and a code snippet. Note that
* markdown strings will be sanitized - that means html will be escaped.~~
* markdown strings will be sanitized - that means html will be escaped.
*
* @deprecated This type is deprecated, please use [`MarkdownString`](#MarkdownString) instead.
*/
@ -2753,7 +2753,7 @@ declare module 'vscode' {
constructor(name: string, kind: SymbolKind, containerName: string, location: Location);
/**
* ~~Creates a new symbol information object.~~
* Creates a new symbol information object.
*
* @deprecated Please use the constructor taking a [location](#Location) object.
*
@ -3874,12 +3874,12 @@ declare module 'vscode' {
/**
* @deprecated Use `CompletionItem.insertText` and `CompletionItem.range` instead.
*
* ~~An [edit](#TextEdit) which is applied to a document when selecting
* An [edit](#TextEdit) which is applied to a document when selecting
* this completion. When an edit is provided the value of
* [insertText](#CompletionItem.insertText) is ignored.~~
* [insertText](#CompletionItem.insertText) is ignored.
*
* ~~The [range](#Range) of the edit must be single-line and on the same
* line completions were [requested](#CompletionItemProvider.provideCompletionItems) at.~~
* The [range](#Range) of the edit must be single-line and on the same
* line completions were [requested](#CompletionItemProvider.provideCompletionItems) at.
*/
textEdit?: TextEdit;
@ -5220,7 +5220,7 @@ declare module 'vscode' {
show(preserveFocus?: boolean): void;
/**
* ~~Reveal this channel in the UI.~~
* Reveal this channel in the UI.
*
* @deprecated Use the overload with just one parameter (`show(preserveFocus?: boolean): void`).
*
@ -6179,7 +6179,7 @@ declare module 'vscode' {
constructor(taskDefinition: TaskDefinition, scope: WorkspaceFolder | TaskScope.Global | TaskScope.Workspace, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution, problemMatchers?: string | string[]);
/**
* ~~Creates a new task.~~
* Creates a new task.
*
* @deprecated Use the new constructors that allow specifying a scope for the task.
*
@ -6266,7 +6266,7 @@ declare module 'vscode' {
* @param token A cancellation token.
* @return an array of tasks
*/
provideTasks(token?: CancellationToken): ProviderResult<T[]>;
provideTasks(token: CancellationToken): ProviderResult<T[]>;
/**
* Resolves a task that has no [`execution`](#Task.execution) set. Tasks are
@ -6281,7 +6281,7 @@ declare module 'vscode' {
* @param token A cancellation token.
* @return The resolved task
*/
resolveTask(task: T, token?: CancellationToken): ProviderResult<T>;
resolveTask(task: T, token: CancellationToken): ProviderResult<T>;
}
/**
@ -8134,8 +8134,8 @@ declare module 'vscode' {
export function setStatusBarMessage(text: string): Disposable;
/**
* ~~Show progress in the Source Control viewlet while running the given callback and while
* its returned promise isn't resolve or rejected.~~
* Show progress in the Source Control viewlet while running the given callback and while
* its returned promise isn't resolve or rejected.
*
* @deprecated Use `withProgress` instead.
*
@ -9571,8 +9571,8 @@ declare module 'vscode' {
export const fs: FileSystem;
/**
* ~~The folder that is open in the editor. `undefined` when no folder
* has been opened.~~
* The folder that is open in the editor. `undefined` when no folder
* has been opened.
*
* @deprecated Use [`workspaceFolders`](#workspace.workspaceFolders) instead.
*/
@ -9952,7 +9952,7 @@ declare module 'vscode' {
export const onDidChangeConfiguration: Event<ConfigurationChangeEvent>;
/**
* ~~Register a task provider.~~
* Register a task provider.
*
* @deprecated Use the corresponding function on the `tasks` namespace instead
*
@ -10691,8 +10691,8 @@ declare module 'vscode' {
export namespace scm {
/**
* ~~The [input box](#SourceControlInputBox) for the last source control
* created by the extension.~~
* The [input box](#SourceControlInputBox) for the last source control
* created by the extension.
*
* @deprecated Use SourceControl.inputBox instead
*/

View file

@ -972,6 +972,11 @@ declare module 'vscode' {
*/
tooltip?: string | MarkdownString | /* for compilation */ any;
/**
* When `iconPath` is a [ThemeColor](#ThemeColor) `iconColor` will be used to set the color of the icon.
*/
iconColor?: ThemeColor;
/**
* @param label Label describing this item
* @param collapsibleState [TreeItemCollapsibleState](#TreeItemCollapsibleState) of the tree item. Default is [TreeItemCollapsibleState.None](#TreeItemCollapsibleState.None)
@ -1322,7 +1327,6 @@ declare module 'vscode' {
readonly isUntitled: boolean;
readonly cells: ReadonlyArray<NotebookCell>;
languages: string[];
displayOrder?: GlobPattern[];
metadata: NotebookDocumentMetadata;
}
@ -2058,6 +2062,11 @@ declare module 'vscode' {
*/
title?: string;
/**
* Human-readable string which is rendered less prominently in the title.
*/
description?: string;
/**
* Event fired when the view is disposed.
*
@ -2086,6 +2095,15 @@ declare module 'vscode' {
* Note that hiding a view using the context menu instead disposes of the view and fires `onDidDispose`.
*/
readonly onDidChangeVisibility: Event<void>;
/**
* Reveal the view in the UI.
*
* If the view is collapsed, this will expand it.
*
* @param preserveFocus When `true` the view will not take focus.
*/
show(preserveFocus?: boolean): void;
}
interface WebviewViewResolveContext<T = unknown> {

View file

@ -34,7 +34,7 @@ export class MainThreadFileSystem implements MainThreadFileSystemShape {
}
$unregisterProvider(handle: number): void {
dispose(this._fileProvider.get(handle));
this._fileProvider.get(handle)?.dispose();
this._fileProvider.delete(handle);
}

View file

@ -7,15 +7,17 @@ import * as DOM from 'vs/base/browser/dom';
import { CancellationToken } from 'vs/base/common/cancellation';
import { Emitter } from 'vs/base/common/event';
import { combinedDisposable, Disposable, DisposableStore, IDisposable } from 'vs/base/common/lifecycle';
import { ResourceMap } from 'vs/base/common/map';
import { URI, UriComponents } from 'vs/base/common/uri';
import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ILogService } from 'vs/platform/log/common/log';
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
import { INotebookEditor } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
import { NotebookCellTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookCellTextModel';
import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel';
import { INotebookCellStatusBarService } from 'vs/workbench/contrib/notebook/common/notebookCellStatusBarService';
import { ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER, CellEditType, CellKind, DisplayOrderKey, ICellEditOperation, ICellRange, IEditor, INotebookDocumentFilter, NotebookCellMetadata, NotebookCellOutputsSplice, NotebookDocumentMetadata, NOTEBOOK_DISPLAY_ORDER, TransientMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER, CellEditType, CellKind, DisplayOrderKey, ICellEditOperation, ICellRange, IEditor, IMainCellDto, INotebookDocumentFilter, NotebookCellMetadata, NotebookCellOutputsSplice, NotebookCellsChangeType, NotebookDocumentMetadata, NOTEBOOK_DISPLAY_ORDER, TransientMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { IMainNotebookController, INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { ExtHostContext, ExtHostNotebookShape, IExtHostContext, INotebookCellStatusBarEntryDto, INotebookDocumentsAndEditorsDelta, INotebookModelAddedData, MainContext, MainThreadNotebookShape, NotebookEditorRevealType, NotebookExtensionDescription } from '../common/extHost.protocol';
@ -58,7 +60,7 @@ class DocumentAndEditorState {
const apiEditors = [];
for (let id in after.textEditors) {
const editor = after.textEditors.get(id)!;
apiEditors.push({ id, documentUri: editor.uri!, selections: editor!.textModel!.selections, visibleRanges: editor.visibleRanges });
apiEditors.push({ id, documentUri: editor.uri!, selections: editor!.getSelectionHandles(), visibleRanges: editor.visibleRanges });
}
return {
@ -72,7 +74,7 @@ class DocumentAndEditorState {
const addedAPIEditors = editorDelta.added.map(add => ({
id: add.getId(),
documentUri: add.uri!,
selections: add.textModel!.selections || [],
selections: add.getSelectionHandles(),
visibleRanges: add.visibleRanges
}));
@ -128,13 +130,13 @@ class DocumentAndEditorState {
@extHostNamedCustomer(MainContext.MainThreadNotebook)
export class MainThreadNotebooks extends Disposable implements MainThreadNotebookShape {
private readonly _notebookProviders = new Map<string, IMainNotebookController>();
private readonly _notebookProviders = new Map<string, { controller: IMainNotebookController, disposable: IDisposable }>();
private readonly _notebookKernelProviders = new Map<number, { extension: NotebookExtensionDescription, emitter: Emitter<URI | undefined>, provider: IDisposable }>();
private readonly _proxy: ExtHostNotebookShape;
private _toDisposeOnEditorRemove = new Map<string, IDisposable>();
private _currentState?: DocumentAndEditorState;
private _editorEventListenersMapping: Map<string, DisposableStore> = new Map();
private _documentEventListenersMapping: Map<string, DisposableStore> = new Map();
private _documentEventListenersMapping: ResourceMap<DisposableStore> = new ResourceMap();
private readonly _cellStatusBarEntries: Map<number, IDisposable> = new Map();
constructor(
@ -162,11 +164,11 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo
}
async removeNotebookTextModel(uri: URI): Promise<void> {
// TODO@rebornix remove this? obsolete?
// TODO@rebornix, remove cell should use emitDelta as well to ensure document/editor events are sent together
this._proxy.$acceptDocumentAndEditorsDelta({ removedDocuments: [uri] });
let textModelDisposableStore = this._documentEventListenersMapping.get(uri.toString());
textModelDisposableStore?.dispose();
this._documentEventListenersMapping.delete(URI.from(uri).toString());
this._documentEventListenersMapping.get(uri)?.dispose();
this._documentEventListenersMapping.delete(uri);
}
private _isDeltaEmpty(delta: INotebookDocumentsAndEditorsDelta) {
@ -230,7 +232,12 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo
if (!this._editorEventListenersMapping.has(editor.getId())) {
const disposableStore = new DisposableStore();
disposableStore.add(editor.onDidChangeVisibleRanges(() => {
this._proxy.$acceptEditorPropertiesChanged(editor.getId(), { visibleRanges: { ranges: editor.visibleRanges } });
this._proxy.$acceptEditorPropertiesChanged(editor.getId(), { visibleRanges: { ranges: editor.visibleRanges }, selections: null });
}));
disposableStore.add(editor.onDidChangeSelection(() => {
const selectionHandles = editor.getSelectionHandles();
this._proxy.$acceptEditorPropertiesChanged(editor.getId(), { visibleRanges: null, selections: { selections: selectionHandles } });
}));
this._editorEventListenersMapping.set(editor.getId(), disposableStore);
@ -255,40 +262,60 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo
notebookEditorAddedHandler(editor);
});
const notebookDocumentAddedHandler = (doc: URI) => {
if (!this._editorEventListenersMapping.has(doc.toString())) {
const cellToDto = (cell: NotebookCellTextModel): IMainCellDto => {
return {
handle: cell.handle,
uri: cell.uri,
source: cell.textBuffer.getLinesContent(),
eol: cell.textBuffer.getEOL(),
language: cell.language,
cellKind: cell.cellKind,
outputs: cell.outputs,
metadata: cell.metadata
};
};
const notebookDocumentAddedHandler = (textModel: NotebookTextModel) => {
if (!this._editorEventListenersMapping.has(textModel.uri.toString())) {
const disposableStore = new DisposableStore();
const textModel = this._notebookService.getNotebookTextModel(doc);
disposableStore.add(textModel!.onDidModelChangeProxy(e => {
this._proxy.$acceptModelChanged(textModel!.uri, e, textModel!.isDirty);
this._proxy.$acceptDocumentPropertiesChanged(doc, { selections: { selections: textModel!.selections }, metadata: null });
}));
disposableStore.add(textModel!.onDidSelectionChange(e => {
const selectionsChange = e ? { selections: e } : null;
this._proxy.$acceptDocumentPropertiesChanged(doc, { selections: selectionsChange, metadata: null });
disposableStore.add(textModel!.onDidChangeContent(e => {
const data =
e.kind === NotebookCellsChangeType.ModelChange || e.kind === NotebookCellsChangeType.Initialize
? {
kind: e.kind,
versionId: e.versionId,
changes: e.changes.map(diff => [diff[0], diff[1], diff[2].map(cell => cellToDto(cell as NotebookCellTextModel))] as [number, number, IMainCellDto[]])
}
: (
e.kind === NotebookCellsChangeType.Move
? {
kind: e.kind,
index: e.index,
length: e.length,
newIdx: e.newIdx,
versionId: e.versionId,
cells: e.cells.map(cell => cellToDto(cell as NotebookCellTextModel))
}
: e
);
this._proxy.$acceptModelChanged(textModel.uri, data, textModel.isDirty);
this._proxy.$acceptDocumentPropertiesChanged(textModel.uri, { metadata: null });
}));
this._editorEventListenersMapping.set(textModel!.uri.toString(), disposableStore);
}
};
this._register(this._notebookService.onNotebookDocumentAdd((documents) => {
documents.forEach(doc => {
notebookDocumentAddedHandler(doc);
});
this._notebookService.listNotebookDocuments().forEach(notebookDocumentAddedHandler);
this._register(this._notebookService.onDidAddNotebookDocument(document => {
notebookDocumentAddedHandler(document);
this._updateState();
}));
this._notebookService.listNotebookDocuments().forEach((doc) => {
notebookDocumentAddedHandler(doc.uri);
});
this._register(this._notebookService.onNotebookDocumentRemove((documents) => {
documents.forEach(doc => {
this._documentEventListenersMapping.get(doc.toString())?.dispose();
this._documentEventListenersMapping.delete(doc.toString());
});
this._register(this._notebookService.onDidRemoveNotebookDocument(uri => {
this._documentEventListenersMapping.get(uri)?.dispose();
this._documentEventListenersMapping.delete(uri);
this._updateState();
}));
@ -403,16 +430,12 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo
// }
}
async $registerNotebookProvider(_extension: NotebookExtensionDescription, _viewType: string, _supportBackup: boolean, options: { transientOutputs: boolean; transientMetadata: TransientMetadata }): Promise<void> {
async $registerNotebookProvider(extension: NotebookExtensionDescription, viewType: string, supportBackup: boolean, options: { transientOutputs: boolean; transientMetadata: TransientMetadata }): Promise<void> {
const controller: IMainNotebookController = {
supportBackup: _supportBackup,
options: options,
supportBackup,
options,
reloadNotebook: async (mainthreadTextModel: NotebookTextModel) => {
const data = await this._proxy.$resolveNotebookData(_viewType, mainthreadTextModel.uri);
if (!data) {
return;
}
const data = await this._proxy.$resolveNotebookData(viewType, mainthreadTextModel.uri);
mainthreadTextModel.updateLanguages(data.languages);
mainthreadTextModel.metadata = data.metadata;
mainthreadTextModel.transientOptions = options;
@ -432,10 +455,6 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo
createNotebook: async (textModel: NotebookTextModel, backupId?: string) => {
// open notebook document
const data = await this._proxy.$resolveNotebookData(textModel.viewType, textModel.uri, backupId);
if (!data) {
return;
}
textModel.updateLanguages(data.languages);
textModel.metadata = data.metadata;
textModel.transientOptions = options;
@ -447,7 +466,7 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo
textModel.insertTemplateCell(mainCell);
}
this._proxy.$acceptDocumentPropertiesChanged(textModel.uri, { selections: null, metadata: textModel.metadata });
this._proxy.$acceptDocumentPropertiesChanged(textModel.uri, { metadata: textModel.metadata });
return;
},
resolveNotebookEditor: async (viewType: string, uri: URI, editorId: string) => {
@ -460,30 +479,32 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo
return this.removeNotebookTextModel(uri);
},
save: async (uri: URI, token: CancellationToken) => {
return this._proxy.$saveNotebook(_viewType, uri, token);
return this._proxy.$saveNotebook(viewType, uri, token);
},
saveAs: async (uri: URI, target: URI, token: CancellationToken) => {
return this._proxy.$saveNotebookAs(_viewType, uri, target, token);
return this._proxy.$saveNotebookAs(viewType, uri, target, token);
},
backup: async (uri: URI, token: CancellationToken) => {
return this._proxy.$backup(_viewType, uri, token);
return this._proxy.$backup(viewType, uri, token);
}
};
this._notebookProviders.set(_viewType, controller);
this._notebookService.registerNotebookController(_viewType, _extension, controller);
const disposable = this._notebookService.registerNotebookController(viewType, extension, controller);
this._notebookProviders.set(viewType, { controller, disposable });
return;
}
async $onNotebookChange(viewType: string, uri: UriComponents): Promise<void> {
async $onNotebookChange(_viewType: string, uri: UriComponents): Promise<void> {
const textModel = this._notebookService.getNotebookTextModel(URI.from(uri));
textModel?.handleUnknownChange();
}
async $unregisterNotebookProvider(viewType: string): Promise<void> {
this._notebookProviders.delete(viewType);
this._notebookService.unregisterNotebookProvider(viewType);
return;
const entry = this._notebookProviders.get(viewType);
if (entry) {
entry.disposable.dispose();
this._notebookProviders.delete(viewType);
}
}
async $registerNotebookKernelProvider(extension: NotebookExtensionDescription, handle: number, documentFilter: INotebookDocumentFilter): Promise<void> {
@ -555,7 +576,16 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo
async $updateNotebookCellMetadata(viewType: string, resource: UriComponents, handle: number, metadata: NotebookCellMetadata): Promise<void> {
this.logService.debug('MainThreadNotebooks#updateNotebookCellMetadata', resource.path, handle, metadata);
const textModel = this._notebookService.getNotebookTextModel(URI.from(resource));
textModel?.changeCellMetadata(handle, metadata, true);
if (!textModel) {
return;
}
const index = textModel.cells.findIndex(cell => cell.handle === handle);
if (index < 0) {
return;
}
textModel.applyEdit(textModel.versionId, [{ editType: CellEditType.Metadata, index, metadata }], true);
}
async $spliceNotebookCellOutputs(viewType: string, resource: UriComponents, cellHandle: number, splices: NotebookCellOutputsSplice[]): Promise<void> {
@ -564,7 +594,7 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo
if (textModel) {
this._notebookService.transformSpliceOutputs(textModel, splices);
textModel.spliceNotebookCellOutputs(cellHandle, splices);
textModel._spliceNotebookCellOutputs(cellHandle, splices);
}
}

View file

@ -29,13 +29,20 @@ export class MainThreadWebviewsViews extends Disposable implements extHostProtoc
}
public $setWebviewViewTitle(handle: extHostProtocol.WebviewHandle, value: string | undefined): void {
const webviewView = this._webviewViews.get(handle);
if (!webviewView) {
throw new Error('unknown webview view');
}
const webviewView = this.getWebviewView(handle);
webviewView.title = value;
}
public $setWebviewViewDescription(handle: extHostProtocol.WebviewHandle, value: string | undefined): void {
const webviewView = this.getWebviewView(handle);
webviewView.description = value;
}
public $show(handle: extHostProtocol.WebviewHandle, preserveFocus: boolean): void {
const webviewView = this.getWebviewView(handle);
webviewView.show(preserveFocus);
}
public $registerWebviewViewProvider(viewType: string, options?: { retainContextWhenHidden?: boolean }): void {
if (this._webviewViewProviders.has(viewType)) {
throw new Error(`View provider for ${viewType} already registered`);
@ -89,5 +96,13 @@ export class MainThreadWebviewsViews extends Disposable implements extHostProtoc
provider.dispose();
this._webviewViewProviders.delete(viewType);
}
private getWebviewView(handle: string): WebviewView {
const webviewView = this._webviewViews.get(handle);
if (!webviewView) {
throw new Error('unknown webview view');
}
return webviewView;
}
}

View file

@ -51,7 +51,7 @@ import { TunnelDto } from 'vs/workbench/api/common/extHostTunnelService';
import { TunnelOptions } from 'vs/platform/remote/common/tunnel';
import { Timeline, TimelineChangeEvent, TimelineOptions, TimelineProviderDescriptor, InternalTimelineOptions } from 'vs/workbench/contrib/timeline/common/timeline';
import { revive } from 'vs/base/common/marshalling';
import { IProcessedOutput, INotebookDisplayOrder, NotebookCellMetadata, NotebookDocumentMetadata, ICellEditOperation, NotebookCellsChangedEvent, NotebookDataDto, IMainCellDto, INotebookDocumentFilter, INotebookKernelInfoDto2, TransientMetadata, INotebookCellStatusBarEntry, ICellRange } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { IProcessedOutput, INotebookDisplayOrder, NotebookCellMetadata, NotebookDocumentMetadata, ICellEditOperation, NotebookCellsChangedEventDto, NotebookDataDto, IMainCellDto, INotebookDocumentFilter, INotebookKernelInfoDto2, TransientMetadata, INotebookCellStatusBarEntry, ICellRange } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { CallHierarchyItem } from 'vs/workbench/contrib/callHierarchy/common/callHierarchy';
import { Dto } from 'vs/base/common/types';
import { ISerializableEnvironmentVariableCollection } from 'vs/workbench/contrib/terminal/common/environmentVariable';
@ -640,6 +640,9 @@ export interface MainThreadWebviewViewsShape extends IDisposable {
$unregisterWebviewViewProvider(viewType: string): void;
$setWebviewViewTitle(handle: WebviewHandle, value: string | undefined): void;
$setWebviewViewDescription(handle: WebviewHandle, value: string | undefined): void;
$show(handle: WebviewHandle, preserveFocus: boolean): void;
}
export interface WebviewPanelViewStateData {
@ -1639,11 +1642,11 @@ export interface INotebookVisibleRangesEvent {
export interface INotebookEditorPropertiesChangeData {
visibleRanges: INotebookVisibleRangesEvent | null;
selections: INotebookSelectionChangeEvent | null;
}
export interface INotebookDocumentPropertiesChangeData {
metadata: NotebookDocumentMetadata | null;
selections: INotebookSelectionChangeEvent | null;
}
export interface INotebookModelAddedData {
@ -1672,7 +1675,7 @@ export interface INotebookDocumentsAndEditorsDelta {
}
export interface ExtHostNotebookShape {
$resolveNotebookData(viewType: string, uri: UriComponents, backupId?: string): Promise<NotebookDataDto | undefined>;
$resolveNotebookData(viewType: string, uri: UriComponents, backupId?: string): Promise<NotebookDataDto>;
$resolveNotebookEditor(viewType: string, uri: UriComponents, editorId: string): Promise<void>;
$provideNotebookKernels(handle: number, uri: UriComponents, token: CancellationToken): Promise<INotebookKernelInfoDto2[]>;
$resolveNotebookKernel(handle: number, editorId: string, uri: UriComponents, kernelId: string, token: CancellationToken): Promise<void>;
@ -1685,7 +1688,7 @@ export interface ExtHostNotebookShape {
$acceptDisplayOrder(displayOrder: INotebookDisplayOrder): void;
$acceptNotebookActiveKernelChange(event: { uri: UriComponents, providerHandle: number | undefined, kernelId: string | undefined }): void;
$onDidReceiveMessage(editorId: string, rendererId: string | undefined, message: unknown): void;
$acceptModelChanged(uriComponents: UriComponents, event: NotebookCellsChangedEvent, isDirty: boolean): void;
$acceptModelChanged(uriComponents: UriComponents, event: NotebookCellsChangedEventDto, isDirty: boolean): void;
$acceptModelSaved(uriComponents: UriComponents): void;
$acceptEditorPropertiesChanged(id: string, data: INotebookEditorPropertiesChangeData): void;
$acceptDocumentPropertiesChanged(uriComponents: UriComponents, data: INotebookDocumentPropertiesChangeData): void;

View file

@ -7,7 +7,7 @@ import { URI, UriComponents } from 'vs/base/common/uri';
import { MainContext, IMainContext, ExtHostFileSystemShape, MainThreadFileSystemShape, IFileChangeDto } from './extHost.protocol';
import type * as vscode from 'vscode';
import * as files from 'vs/platform/files/common/files';
import { IDisposable, toDisposable, dispose } from 'vs/base/common/lifecycle';
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { FileChangeType } from 'vs/workbench/api/common/extHostTypes';
import * as typeConverter from 'vs/workbench/api/common/extHostTypeConverters';
import { ExtHostLanguageFeatures } from 'vs/workbench/api/common/extHostLanguageFeatures';
@ -127,7 +127,7 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
}
dispose(): void {
dispose(this._linkProviderRegistration);
this._linkProviderRegistration?.dispose();
}
private _registerLinkProviderIfNotYetRegistered(): void {

View file

@ -25,7 +25,7 @@ import { ILogService } from 'vs/platform/log/common/log';
import { CancellationToken } from 'vs/base/common/cancellation';
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { IURITransformer } from 'vs/base/common/uriIpc';
import { DisposableStore, dispose } from 'vs/base/common/lifecycle';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { VSBuffer } from 'vs/base/common/buffer';
import { encodeSemanticTokensDto } from 'vs/workbench/api/common/shared/semanticTokensDto';
import { IdGenerator } from 'vs/base/common/idGenerator';
@ -177,7 +177,7 @@ class CodeLensAdapter {
}
releaseCodeLenses(cachedId: number): void {
dispose(this._disposables.get(cachedId));
this._disposables.get(cachedId)?.dispose();
this._disposables.delete(cachedId);
this._cache.delete(cachedId);
}
@ -455,7 +455,7 @@ class CodeActionAdapter {
}
public releaseCodeActions(cachedId: number): void {
dispose(this._disposables.get(cachedId));
this._disposables.get(cachedId)?.dispose();
this._disposables.delete(cachedId);
this._cache.delete(cachedId);
}
@ -938,7 +938,7 @@ class SuggestAdapter {
}
releaseCompletionItems(id: number): any {
dispose(this._disposables.get(id));
this._disposables.get(id)?.dispose();
this._disposables.delete(id);
this._cache.delete(id);
}

View file

@ -22,7 +22,7 @@ import { IExtensionStoragePaths } from 'vs/workbench/api/common/extHostStoragePa
import * as typeConverters from 'vs/workbench/api/common/extHostTypeConverters';
import * as extHostTypes from 'vs/workbench/api/common/extHostTypes';
import { asWebviewUri, WebviewInitData } from 'vs/workbench/api/common/shared/webview';
import { addIdToOutput, CellEditType, CellOutputKind, CellStatusbarAlignment, CellUri, diff, ICellEditOperation, ICellReplaceEdit, IMainCellDto, INotebookCellStatusBarEntry, INotebookDisplayOrder, INotebookEditData, INotebookKernelInfoDto2, IProcessedOutput, NotebookCellMetadata, NotebookCellsChangedEvent, NotebookCellsChangeType, NotebookCellsSplice2, NotebookDataDto, notebookDocumentMetadataDefaults } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { addIdToOutput, CellEditType, CellOutputKind, CellStatusbarAlignment, CellUri, diff, ICellEditOperation, ICellReplaceEdit, IMainCellDto, INotebookCellStatusBarEntry, INotebookDisplayOrder, INotebookEditData, INotebookKernelInfoDto2, IProcessedOutput, NotebookCellMetadata, NotebookCellsChangedEventDto, NotebookCellsChangeType, NotebookCellsSplice2, NotebookDataDto, notebookDocumentMetadataDefaults } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import * as vscode from 'vscode';
import { Cache } from './cache';
import { ResourceMap } from 'vs/base/common/map';
@ -212,10 +212,8 @@ export class ExtHostNotebookDocument extends Disposable {
private _cellDisposableMapping = new Map<number, DisposableStore>();
private _notebook: vscode.NotebookDocument | undefined;
private _metadata: Required<vscode.NotebookDocumentMetadata> = notebookDocumentMetadataDefaults;
private _metadata: Required<vscode.NotebookDocumentMetadata>;
private _metadataChangeListener: IDisposable;
private _displayOrder: string[] = [];
private _versionId = 0;
private _isDirty: boolean = false;
private _backupCounter = 1;
@ -230,13 +228,14 @@ export class ExtHostNotebookDocument extends Disposable {
private readonly _documentsAndEditors: ExtHostDocumentsAndEditors,
private readonly _emitter: INotebookEventEmitter,
private readonly _viewType: string,
metadata: Required<vscode.NotebookDocumentMetadata>,
public readonly uri: URI,
public readonly renderingHandler: ExtHostNotebookOutputRenderingHandler,
private readonly _storagePath: URI | undefined
) {
super();
const observableMetadata = getObservable(notebookDocumentMetadataDefaults);
const observableMetadata = getObservable(metadata);
this._metadata = observableMetadata.proxy;
this._metadataChangeListener = this._register(observableMetadata.onDidChange(() => {
this._tryUpdateMetadata();
@ -284,8 +283,6 @@ export class ExtHostNotebookDocument extends Disposable {
get cells(): ReadonlyArray<vscode.NotebookCell> { return that._cells.map(cell => cell.cell); },
get languages() { return that._languages; },
set languages(value: string[]) { that._trySetLanguages(value); },
get displayOrder() { return that._displayOrder; },
set displayOrder(value: string[]) { that._displayOrder = value; },
get metadata() { return that._metadata; },
set metadata(value: Required<vscode.NotebookDocumentMetadata>) { that._updateMetadata(value); },
});
@ -316,7 +313,7 @@ export class ExtHostNotebookDocument extends Disposable {
this._backup = undefined;
}
acceptModelChanged(event: NotebookCellsChangedEvent, isDirty: boolean): void {
acceptModelChanged(event: NotebookCellsChangedEventDto, isDirty: boolean): void {
this._versionId = event.versionId;
this._isDirty = isDirty;
if (event.kind === NotebookCellsChangeType.Initialize) {
@ -327,13 +324,9 @@ export class ExtHostNotebookDocument extends Disposable {
this._moveCell(event.index, event.newIdx);
} else if (event.kind === NotebookCellsChangeType.Output) {
this._setCellOutputs(event.index, event.outputs);
} else if (event.kind === NotebookCellsChangeType.CellClearOutput) {
this._clearCellOutputs(event.index);
} else if (event.kind === NotebookCellsChangeType.CellsClearOutput) {
this._clearAllCellOutputs();
} else if (event.kind === NotebookCellsChangeType.ChangeLanguage) {
this._changeCellLanguage(event.index, event.language);
} else if (event.kind === NotebookCellsChangeType.ChangeMetadata) {
} else if (event.kind === NotebookCellsChangeType.ChangeCellMetadata) {
this._changeCellMetadata(event.index, event.metadata);
}
}
@ -424,25 +417,6 @@ export class ExtHostNotebookDocument extends Disposable {
this._emitter.emitCellOutputsChange({ document: this.notebookDocument, cells: [cell.cell] });
}
private _clearCellOutputs(index: number): void {
const cell = this._cells[index].cell;
cell.outputs = [];
const event: vscode.NotebookCellOutputsChangeEvent = { document: this.notebookDocument, cells: [cell] };
this._emitter.emitCellOutputsChange(event);
}
private _clearAllCellOutputs(): void {
const modifedCells: vscode.NotebookCell[] = [];
this._cells.forEach(({ cell }) => {
if (cell.outputs.length !== 0) {
cell.outputs = [];
modifedCells.push(cell);
}
});
const event: vscode.NotebookCellOutputsChangeEvent = { document: this.notebookDocument, cells: modifedCells };
this._emitter.emitCellOutputsChange(event);
}
private _changeCellLanguage(index: number, language: string): void {
const cell = this._cells[index];
const event: vscode.NotebookCellLanguageChangeEvent = { document: this.notebookDocument, cell: cell.cell, language };
@ -904,7 +878,6 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
private readonly _notebookKernels = new Map<string, { readonly kernel: vscode.NotebookKernel, readonly extension: IExtensionDescription; }>();
private readonly _notebookKernelProviders = new Map<number, ExtHostNotebookKernelProviderAdapter>();
private readonly _documents = new ResourceMap<ExtHostNotebookDocument>();
private readonly _unInitializedDocuments = new ResourceMap<ExtHostNotebookDocument>();
private readonly _editors = new Map<string, { editor: ExtHostNotebookEditor; }>();
private readonly _webviewComm = new Map<string, ExtHostWebviewCommWrapper>();
private readonly _commandsConverter: CommandsConverter;
@ -1076,49 +1049,24 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
});
}
async $resolveNotebookData(viewType: string, uri: UriComponents, backupId?: string): Promise<NotebookDataDto | undefined> {
async $resolveNotebookData(viewType: string, uri: UriComponents, backupId?: string): Promise<NotebookDataDto> {
const provider = this._notebookContentProviders.get(viewType);
const revivedUri = URI.revive(uri);
if (!provider) {
return;
throw new Error(`NO provider for '${viewType}'`);
}
const storageRoot = this._extensionStoragePaths.workspaceValue(provider.extension) ?? this._extensionStoragePaths.globalValue(provider.extension);
let document = this._documents.get(revivedUri);
if (!document) {
const that = this;
document = this._unInitializedDocuments.get(revivedUri) ?? new ExtHostNotebookDocument(this._proxy, this._documentsAndEditors, {
emitModelChange(event: vscode.NotebookCellsChangeEvent): void {
that._onDidChangeNotebookCells.fire(event);
},
emitCellOutputsChange(event: vscode.NotebookCellOutputsChangeEvent): void {
that._onDidChangeCellOutputs.fire(event);
},
emitCellLanguageChange(event: vscode.NotebookCellLanguageChangeEvent): void {
that._onDidChangeCellLanguage.fire(event);
},
emitCellMetadataChange(event: vscode.NotebookCellMetadataChangeEvent): void {
that._onDidChangeCellMetadata.fire(event);
},
}, viewType, revivedUri, this, storageRoot);
this._unInitializedDocuments.set(revivedUri, document);
}
const rawCells = await provider.provider.openNotebook(URI.revive(uri), { backupId });
const dto = {
const data = await provider.provider.openNotebook(URI.revive(uri), { backupId });
return {
metadata: {
...notebookDocumentMetadataDefaults,
...rawCells.metadata
...data.metadata
},
languages: rawCells.languages,
cells: rawCells.cells.map(cell => ({
languages: data.languages,
cells: data.cells.map(cell => ({
...cell,
outputs: cell.outputs.map(o => addIdToOutput(o))
})),
};
return dto;
}
async $resolveNotebookEditor(viewType: string, uri: UriComponents, editorId: string): Promise<void> {
@ -1259,7 +1207,7 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
}
}
// TODO: remove document - editor one on one mapping
// TODO@rebornix: remove document - editor one on one mapping
private _getEditorFromURI(uriComponents: UriComponents) {
const uriStr = URI.revive(uriComponents).toString();
let editor: { editor: ExtHostNotebookEditor; } | undefined;
@ -1276,7 +1224,7 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
this._webviewComm.get(editorId)?.onDidReceiveMessage(forRendererType, message);
}
$acceptModelChanged(uriComponents: UriComponents, event: NotebookCellsChangedEvent, isDirty: boolean): void {
$acceptModelChanged(uriComponents: UriComponents, event: NotebookCellsChangedEventDto, isDirty: boolean): void {
const document = this._documents.get(URI.revive(uriComponents));
if (document) {
document.acceptModelChanged(event, isDirty);
@ -1312,15 +1260,6 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
visibleRanges: editor.editor.visibleRanges
});
}
}
$acceptDocumentPropertiesChanged(uriComponents: UriComponents, data: INotebookDocumentPropertiesChangeData): void {
this.logService.debug('ExtHostNotebook#$acceptDocumentPropertiesChanged', uriComponents.path, data);
const editor = this._getEditorFromURI(uriComponents);
if (!editor) {
return;
}
if (data.selections) {
if (data.selections.selections.length) {
@ -1335,7 +1274,15 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
selection: editor.editor.selection
});
}
}
$acceptDocumentPropertiesChanged(uriComponents: UriComponents, data: INotebookDocumentPropertiesChangeData): void {
this.logService.debug('ExtHostNotebook#$acceptDocumentPropertiesChanged', uriComponents.path, data);
const editor = this._getEditorFromURI(uriComponents);
if (!editor) {
return;
}
if (data.metadata) {
editor.editor.notebookData.notebookDocument.metadata = {
@ -1406,64 +1353,55 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
const addedCellDocuments: IModelAddedData[] = [];
for (const modelData of delta.addedDocuments) {
const revivedUri = URI.revive(modelData.uri);
const uri = URI.revive(modelData.uri);
const viewType = modelData.viewType;
const entry = this._notebookContentProviders.get(viewType);
const storageRoot = entry && (this._extensionStoragePaths.workspaceValue(entry.extension) ?? this._extensionStoragePaths.globalValue(entry.extension));
if (this._documents.has(uri)) {
throw new Error(`adding EXISTING notebook ${uri}`);
}
const that = this;
if (!this._documents.has(revivedUri)) {
const that = this;
const document = this._unInitializedDocuments.get(revivedUri) ?? new ExtHostNotebookDocument(this._proxy, this._documentsAndEditors, {
emitModelChange(event: vscode.NotebookCellsChangeEvent): void {
that._onDidChangeNotebookCells.fire(event);
},
emitCellOutputsChange(event: vscode.NotebookCellOutputsChangeEvent): void {
that._onDidChangeCellOutputs.fire(event);
},
emitCellLanguageChange(event: vscode.NotebookCellLanguageChangeEvent): void {
that._onDidChangeCellLanguage.fire(event);
},
emitCellMetadataChange(event: vscode.NotebookCellMetadataChangeEvent): void {
that._onDidChangeCellMetadata.fire(event);
}
}, viewType, revivedUri, this, storageRoot);
this._unInitializedDocuments.delete(revivedUri);
if (modelData.metadata) {
document.notebookDocument.metadata = {
...notebookDocumentMetadataDefaults,
...modelData.metadata
};
const document = new ExtHostNotebookDocument(this._proxy, this._documentsAndEditors, {
emitModelChange(event: vscode.NotebookCellsChangeEvent): void {
that._onDidChangeNotebookCells.fire(event);
},
emitCellOutputsChange(event: vscode.NotebookCellOutputsChangeEvent): void {
that._onDidChangeCellOutputs.fire(event);
},
emitCellLanguageChange(event: vscode.NotebookCellLanguageChangeEvent): void {
that._onDidChangeCellLanguage.fire(event);
},
emitCellMetadataChange(event: vscode.NotebookCellMetadataChangeEvent): void {
that._onDidChangeCellMetadata.fire(event);
}
}, viewType, { ...notebookDocumentMetadataDefaults, ...modelData.metadata }, uri, this, storageRoot);
document.acceptModelChanged({
kind: NotebookCellsChangeType.Initialize,
versionId: modelData.versionId,
changes: [[
0,
0,
modelData.cells
]]
}, false);
document.acceptModelChanged({
kind: NotebookCellsChangeType.Initialize,
versionId: modelData.versionId,
changes: [[
0,
0,
modelData.cells
]]
}, false);
// add cell document as vscode.TextDocument
addedCellDocuments.push(...modelData.cells.map(cell => ExtHostCell.asModelAddData(document.notebookDocument, cell)));
// add cell document as vscode.TextDocument
addedCellDocuments.push(...modelData.cells.map(cell => ExtHostCell.asModelAddData(document.notebookDocument, cell)));
this._documents.get(revivedUri)?.dispose();
this._documents.set(revivedUri, document);
this._documents.get(uri)?.dispose();
this._documents.set(uri, document);
// create editor if populated
if (modelData.attachedEditor) {
this._createExtHostEditor(document, modelData.attachedEditor.id, modelData.attachedEditor.selections, modelData.attachedEditor.visibleRanges);
editorChanged = true;
}
// create editor if populated
if (modelData.attachedEditor) {
this._createExtHostEditor(document, modelData.attachedEditor.id, modelData.attachedEditor.selections, modelData.attachedEditor.visibleRanges);
editorChanged = true;
}
this._documentsAndEditors.$acceptDocumentsAndEditorsDelta({ addedDocuments: addedCellDocuments });
const document = this._documents.get(revivedUri)!;
this._onDidOpenNotebookDocument.fire(document.notebookDocument);
}
}

View file

@ -13,7 +13,7 @@ import { ExtHostTreeViewsShape, MainThreadTreeViewsShape } from './extHost.proto
import { ITreeItem, TreeViewItemHandleArg, ITreeItemLabel, IRevealOptions } from 'vs/workbench/common/views';
import { ExtHostCommands, CommandsConverter } from 'vs/workbench/api/common/extHostCommands';
import { asPromise } from 'vs/base/common/async';
import { TreeItemCollapsibleState, ThemeIcon, MarkdownString as MarkdownStringType } from 'vs/workbench/api/common/extHostTypes';
import { TreeItemCollapsibleState, ThemeIcon, MarkdownString as MarkdownStringType, ThemeColor } from 'vs/workbench/api/common/extHostTypes';
import { isUndefinedOrNull, isString } from 'vs/base/common/types';
import { equals, coalesce } from 'vs/base/common/arrays';
import { ILogService } from 'vs/platform/log/common/log';
@ -550,6 +550,7 @@ class ExtHostTreeView<T> extends Disposable {
icon,
iconDark: this.getDarkIconPath(extensionTreeItem) || icon,
themeIcon: extensionTreeItem.iconPath instanceof ThemeIcon ? { id: extensionTreeItem.iconPath.id } : undefined,
iconColor: this.getIconColor(extensionTreeItem),
collapsibleState: isUndefinedOrNull(extensionTreeItem.collapsibleState) ? TreeItemCollapsibleState.None : extensionTreeItem.collapsibleState,
accessibilityInformation: extensionTreeItem.accessibilityInformation
};
@ -563,6 +564,11 @@ class ExtHostTreeView<T> extends Disposable {
};
}
private getIconColor(extensionTreeItem: vscode.TreeItem2): ThemeColor | undefined {
checkProposedApiEnabled(this.extension);
return (extensionTreeItem.iconPath instanceof ThemeIcon) ? <ThemeColor>extensionTreeItem.iconColor : undefined;
}
private createHandle(element: T, { id, label, resourceUri }: vscode.TreeItem, parent: TreeNode | Root, returnFirst?: boolean): TreeItemHandle {
if (id) {
return `${ExtHostTreeView.ID_HANDLE_PREFIX}/${id}`;

View file

@ -23,6 +23,7 @@ class ExtHostWebviewView extends Disposable implements vscode.WebviewView {
#isDisposed = false;
#isVisible: boolean;
#title: string | undefined;
#description: string | undefined;
constructor(
handle: extHostProtocol.WebviewHandle,
@ -70,6 +71,19 @@ class ExtHostWebviewView extends Disposable implements vscode.WebviewView {
}
}
public get description(): string | undefined {
this.assertNotDisposed();
return this.#description;
}
public set description(value: string | undefined) {
this.assertNotDisposed();
if (this.#description !== value) {
this.#description = value;
this.#proxy.$setWebviewViewDescription(this.#handle, value);
}
}
public get visible(): boolean { return this.#isVisible; }
public get webview(): vscode.Webview { return this.#webview; }
@ -85,6 +99,11 @@ class ExtHostWebviewView extends Disposable implements vscode.WebviewView {
this.#onDidChangeVisibility.fire();
}
public show(preserveFocus?: boolean): void {
this.assertNotDisposed();
this.#proxy.$show(this.#handle, !!preserveFocus);
}
private assertNotDisposed() {
if (this.#isDisposed) {
throw new Error('Webview is disposed');

Some files were not shown because too many files have changed in this diff Show more