chore(vscode): update to 1.56.0
This commit is contained in:
32
lib/vscode/extensions/markdown-language-features/esbuild.js
Normal file
32
lib/vscode/extensions/markdown-language-features/esbuild.js
Normal file
@ -0,0 +1,32 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
const path = require('path');
|
||||
const esbuild = require('esbuild');
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
const isWatch = args.indexOf('--watch') >= 0;
|
||||
|
||||
let outputRoot = __dirname;
|
||||
const outputRootIndex = args.indexOf('--outputRoot');
|
||||
if (outputRootIndex >= 0) {
|
||||
outputRoot = args[outputRootIndex + 1];
|
||||
}
|
||||
|
||||
const outDir = path.join(outputRoot, 'notebook-out');
|
||||
|
||||
esbuild.build({
|
||||
entryPoints: [
|
||||
path.join(__dirname, 'notebook', 'index.ts'),
|
||||
],
|
||||
bundle: true,
|
||||
minify: true,
|
||||
sourcemap: false,
|
||||
format: 'esm',
|
||||
outdir: outDir,
|
||||
platform: 'browser',
|
||||
target: ['es2020'],
|
||||
incremental: isWatch,
|
||||
}).catch(() => process.exit(1));
|
@ -3,26 +3,37 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as MarkdownIt from 'markdown-it';
|
||||
const MarkdownIt = require('markdown-it');
|
||||
|
||||
declare const acquireNotebookRendererApi: any;
|
||||
type extendMarkdownItFnType = (
|
||||
(f: (md: MarkdownIt.MarkdownIt) => void) => void
|
||||
);
|
||||
|
||||
(function () {
|
||||
const markdownIt = new MarkdownIt({
|
||||
export async function activate(ctx: {
|
||||
dependencies: ReadonlyArray<{ entrypoint: string }>
|
||||
}) {
|
||||
let markdownIt = new MarkdownIt({
|
||||
html: true
|
||||
});
|
||||
|
||||
(globalThis as any).extendMarkdownIt = ((f: (md: MarkdownIt.MarkdownIt) => void) => {
|
||||
f(markdownIt);
|
||||
}) as extendMarkdownItFnType;
|
||||
// Should we load the deps before this point?
|
||||
// Also could we await inside `renderMarkup`?
|
||||
await Promise.all(ctx.dependencies.map(async (dep) => {
|
||||
try {
|
||||
const api = await import(dep.entrypoint);
|
||||
if (api?.extendMarkdownIt) {
|
||||
markdownIt = api.extendMarkdownIt(markdownIt);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Could not load markdown entryPoint', e);
|
||||
}
|
||||
}));
|
||||
|
||||
const notebook = acquireNotebookRendererApi('notebookCoreTestRenderer');
|
||||
return {
|
||||
renderMarkup: (context: { element: HTMLElement, content: string }) => {
|
||||
const rendered = markdownIt.render(context.content);
|
||||
context.element.innerHTML = rendered;
|
||||
|
||||
notebook.onDidCreateMarkdown(({ element, content }: any) => {
|
||||
const rendered = markdownIt.render(content);
|
||||
element.innerHTML = rendered;
|
||||
});
|
||||
}());
|
||||
// Insert styles into markdown preview shadow dom so that they are applied
|
||||
for (const markdownStyleNode of document.getElementsByClassName('markdown-style')) {
|
||||
context.element.appendChild(markdownStyleNode.cloneNode(true));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -0,0 +1,13 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist/",
|
||||
"jsx": "react",
|
||||
"module": "es2020",
|
||||
"lib": [
|
||||
"es2018",
|
||||
"DOM",
|
||||
"DOM.Iterable"
|
||||
]
|
||||
}
|
||||
}
|
@ -29,12 +29,25 @@
|
||||
"onWebviewPanel:markdown.preview",
|
||||
"onCustomEditor:vscode.markdown.preview.editor"
|
||||
],
|
||||
"capabilities": {
|
||||
"virtualWorkspaces": true,
|
||||
"untrustedWorkspaces": {
|
||||
"supported": "limited",
|
||||
"description": "%workspaceTrust%",
|
||||
"restrictedConfigurations": [
|
||||
"markdown.styles"
|
||||
]
|
||||
}
|
||||
},
|
||||
"contributes": {
|
||||
"notebookMarkdownRenderer": [
|
||||
"notebookMarkupRenderers": [
|
||||
{
|
||||
"id": "markdownItRenderer",
|
||||
"displayName": "Markdown it renderer",
|
||||
"entrypoint": "./notebook-out/index.js"
|
||||
"entrypoint": "./notebook-out/index.js",
|
||||
"mimeTypes": [
|
||||
"text/markdown"
|
||||
]
|
||||
}
|
||||
],
|
||||
"commands": [
|
||||
@ -207,6 +220,12 @@
|
||||
"description": "%markdown.preview.linkify%",
|
||||
"scope": "resource"
|
||||
},
|
||||
"markdown.preview.typographer": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "%markdown.preview.typographer%",
|
||||
"scope": "resource"
|
||||
},
|
||||
"markdown.preview.fontFamily": {
|
||||
"type": "string",
|
||||
"default": "-apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', system-ui, 'Ubuntu', 'Droid Sans', sans-serif",
|
||||
@ -327,7 +346,7 @@
|
||||
"vscode:prepublish": "npm run build-ext && npm run build-preview",
|
||||
"build-ext": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:markdown-language-features ./tsconfig.json",
|
||||
"build-preview": "npx webpack-cli --mode production",
|
||||
"build-notebook": "npx webpack-cli --config webpack.notebook --mode production",
|
||||
"build-notebook": "node ./esbuild",
|
||||
"compile-web": "npx webpack-cli --config extension-browser.webpack.config --mode none",
|
||||
"watch-web": "npx webpack-cli --config extension-browser.webpack.config --mode none --watch --info-verbosity verbose"
|
||||
},
|
||||
|
@ -3,6 +3,7 @@
|
||||
"description": "Provides rich language support for Markdown.",
|
||||
"markdown.preview.breaks.desc": "Sets how line-breaks are rendered in the Markdown preview. Setting it to 'true' creates a <br> for newlines inside paragraphs.",
|
||||
"markdown.preview.linkify": "Enable or disable conversion of URL-like text to links in the Markdown preview.",
|
||||
"markdown.preview.typographer": "Enable or disable some language-neutral replacement and quotes beautification in the Markdown preview.",
|
||||
"markdown.preview.doubleClickToSwitchToEditor.desc": "Double click in the Markdown preview to switch to the editor.",
|
||||
"markdown.preview.fontFamily.desc": "Controls the font family used in the Markdown preview.",
|
||||
"markdown.preview.fontSize.desc": "Controls the font size in pixels used in the Markdown preview.",
|
||||
@ -24,5 +25,6 @@
|
||||
"configuration.markdown.preview.openMarkdownLinks.inPreview": "Try to open links in the Markdown preview.",
|
||||
"configuration.markdown.links.openLocation.description": "Controls where links in Markdown files should be opened.",
|
||||
"configuration.markdown.links.openLocation.currentGroup": "Open links in the active editor group.",
|
||||
"configuration.markdown.links.openLocation.beside": "Open links beside the active editor."
|
||||
"configuration.markdown.links.openLocation.beside": "Open links beside the active editor.",
|
||||
"workspaceTrust": "Required for loading styles configured in the workspace."
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ window.onload = () => {
|
||||
function doAfterImagesLoaded(cb: () => void) {
|
||||
const imgElements = document.getElementsByTagName('img');
|
||||
if (imgElements.length > 0) {
|
||||
const ps = Array.from(imgElements).map(e => {
|
||||
const ps = Array.from(imgElements, e => {
|
||||
if (e.complete) {
|
||||
return Promise.resolve();
|
||||
} else {
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "../../shared.tsconfig.json",
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist/",
|
||||
"jsx": "react",
|
||||
|
@ -207,7 +207,7 @@ class MarkdownPreview extends Disposable implements WebviewResourceProvider {
|
||||
this.updatePreview();
|
||||
}
|
||||
|
||||
dispose() {
|
||||
override dispose() {
|
||||
super.dispose();
|
||||
this._disposed = true;
|
||||
clearTimeout(this.throttleTimer);
|
||||
@ -434,14 +434,14 @@ class MarkdownPreview extends Disposable implements WebviewResourceProvider {
|
||||
private async onDidClickPreviewLink(href: string) {
|
||||
let [hrefPath, fragment] = decodeURIComponent(href).split('#');
|
||||
|
||||
// We perviously already resolve absolute paths.
|
||||
// Now make sure we handle relative file paths
|
||||
if (hrefPath[0] !== '/') {
|
||||
// Fix #93691, use this.resource.fsPath instead of this.resource.path
|
||||
hrefPath = path.join(path.dirname(this.resource.fsPath), hrefPath);
|
||||
// We perviously already resolve absolute paths.
|
||||
// Now make sure we handle relative file paths
|
||||
const dirnameUri = vscode.Uri.parse(path.dirname(this.resource.path));
|
||||
hrefPath = vscode.Uri.joinPath(dirnameUri, hrefPath).path;
|
||||
} else {
|
||||
// Handle any normalized file paths
|
||||
hrefPath = vscode.Uri.parse(hrefPath.replace('/file', '')).fsPath;
|
||||
hrefPath = vscode.Uri.parse(hrefPath.replace('/file', '')).path;
|
||||
}
|
||||
|
||||
const config = vscode.workspace.getConfiguration('markdown', this.resource);
|
||||
@ -537,7 +537,7 @@ export class StaticMarkdownPreview extends Disposable implements ManagedMarkdown
|
||||
private readonly _onDidChangeViewState = this._register(new vscode.EventEmitter<vscode.WebviewPanelOnDidChangeViewStateEvent>());
|
||||
public readonly onDidChangeViewState = this._onDidChangeViewState.event;
|
||||
|
||||
dispose() {
|
||||
override dispose() {
|
||||
this._onDispose.fire();
|
||||
super.dispose();
|
||||
}
|
||||
@ -682,7 +682,7 @@ export class DynamicMarkdownPreview extends Disposable implements ManagedMarkdow
|
||||
private readonly _onDidChangeViewStateEmitter = this._register(new vscode.EventEmitter<vscode.WebviewPanelOnDidChangeViewStateEvent>());
|
||||
public readonly onDidChangeViewState = this._onDidChangeViewStateEmitter.event;
|
||||
|
||||
dispose() {
|
||||
override dispose() {
|
||||
this._preview.dispose();
|
||||
this._webviewPanel.dispose();
|
||||
|
||||
|
@ -23,7 +23,7 @@ class PreviewStore<T extends ManagedMarkdownPreview> extends Disposable {
|
||||
|
||||
private readonly _previews = new Set<T>();
|
||||
|
||||
public dispose(): void {
|
||||
public override dispose(): void {
|
||||
super.dispose();
|
||||
for (const preview of this._previews) {
|
||||
preview.dispose();
|
||||
|
@ -134,7 +134,7 @@ export default class MarkdownWorkspaceSymbolProvider extends Disposable implemen
|
||||
this._workspaceMarkdownDocumentProvider.onDidDeleteMarkdownDocument(this.onDidDeleteDocument, this, this._disposables);
|
||||
}
|
||||
|
||||
const allSymbolsSets = await Promise.all(Array.from(this._symbolCache.values()).map(x => x.value));
|
||||
const allSymbolsSets = await Promise.all(Array.from(this._symbolCache.values(), x => x.value));
|
||||
const allSymbols = allSymbolsSets.flat();
|
||||
return allSymbols.filter(symbolInformation => symbolInformation.name.toLowerCase().indexOf(query.toLowerCase()) !== -1);
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ const UNICODE_NEWLINE_REGEX = /\u2028|\u2029/g;
|
||||
interface MarkdownItConfig {
|
||||
readonly breaks: boolean;
|
||||
readonly linkify: boolean;
|
||||
readonly typographer: boolean;
|
||||
}
|
||||
|
||||
class TokenCache {
|
||||
@ -187,7 +188,8 @@ export class MarkdownEngine {
|
||||
const config = vscode.workspace.getConfiguration('markdown', resource);
|
||||
return {
|
||||
breaks: config.get<boolean>('preview.breaks', false),
|
||||
linkify: config.get<boolean>('preview.linkify', true)
|
||||
linkify: config.get<boolean>('preview.linkify', true),
|
||||
typographer: config.get<boolean>('preview.typographer', false)
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ const testRunner = require('../../../../test/integration/electron/testrunner');
|
||||
|
||||
const options: any = {
|
||||
ui: 'tdd',
|
||||
color: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
|
||||
color: true,
|
||||
timeout: 60000
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "../shared.tsconfig.json",
|
||||
"extends": "../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out",
|
||||
"experimentalDecorators": true,
|
||||
@ -14,4 +14,4 @@
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -1,28 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: {
|
||||
index: path.join(__dirname, 'notebook', 'index.ts')
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
use: 'ts-loader',
|
||||
exclude: /node_modules/
|
||||
}
|
||||
]
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.tsx', '.ts', '.js']
|
||||
},
|
||||
output: {
|
||||
filename: '[name].js',
|
||||
path: path.resolve(__dirname, 'notebook-out')
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user