mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
Merge branch 'master' into next
This commit is contained in:
@@ -159,8 +159,15 @@ class ExtHostApiCommands {
|
||||
description: `
|
||||
Render the html of the resource in an editor view.
|
||||
|
||||
Links contained in the document will be handled by VS Code whereby it supports file-resources and virtual resources
|
||||
as well as triggering commands using the 'command'-scheme.
|
||||
Links contained in the document will be handled by VS Code whereby it supports \`file\`-resources and
|
||||
[virtual](https://github.com/Microsoft/vscode/blob/master/src/vs/vscode.d.ts#L3295)-resources
|
||||
as well as triggering commands using the \`command\`-scheme. Use the query part of a command-uri to pass along JSON-encoded
|
||||
arguments - note that URL-encoding must be applied. The snippet below defines a command-link that calls the _previewHtml_
|
||||
command and passes along an uri:
|
||||
\`\`\`
|
||||
let href = encodeURI('command:vscode.previewHtml?' + JSON.stringify(someUri));
|
||||
let html = '<a href="' + href + '">Show Resource...</a>.';
|
||||
\`\`\`
|
||||
`,
|
||||
args: [
|
||||
{ name: 'uri', description: 'Uri of the resource to preview.', constraint: value => value instanceof URI || typeof value === 'string' },
|
||||
|
||||
@@ -126,6 +126,11 @@ export class MainThreadTextEditor {
|
||||
this._codeEditor = codeEditor;
|
||||
if (this._codeEditor) {
|
||||
|
||||
// Catch early the case that this code editor gets a different model set and disassociate from this model
|
||||
this._codeEditorListeners.push(this._codeEditor.addListener2(EditorCommon.EventType.ModelChanged, () => {
|
||||
this.setCodeEditor(null);
|
||||
}));
|
||||
|
||||
let forwardSelection = () => {
|
||||
this._lastSelection = this._codeEditor.getSelections();
|
||||
this._onSelectionChanged.fire(this._lastSelection);
|
||||
@@ -294,6 +299,9 @@ export class MainThreadTextEditor {
|
||||
}
|
||||
|
||||
public matches(editor: IEditor): boolean {
|
||||
if (!editor) {
|
||||
return false;
|
||||
}
|
||||
return editor.getControl() === this._codeEditor;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user