mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
Fix #86058
This commit is contained in:
@@ -14,7 +14,7 @@ import { EMPTY_ELEMENTS } from './htmlEmptyTagsShared';
|
||||
import { activateTagClosing } from './tagClosing';
|
||||
import TelemetryReporter from 'vscode-extension-telemetry';
|
||||
import { getCustomDataPathsInAllWorkspaces, getCustomDataPathsFromAllExtensions } from './customData';
|
||||
import { activateMatchingTagPosition as activateMatchingTagSelection } from './matchingTag';
|
||||
import { activateMirrorCursor } from './mirrorCursor';
|
||||
|
||||
namespace TagCloseRequest {
|
||||
export const type: RequestType<TextDocumentPositionParams, string, any, any> = new RequestType('html/tag');
|
||||
@@ -118,7 +118,7 @@ export function activate(context: ExtensionContext) {
|
||||
return client.sendRequest(MatchingTagPositionRequest.type, param);
|
||||
};
|
||||
|
||||
disposable = activateMatchingTagSelection(matchingTagPositionRequestor, { html: true, handlebars: true }, 'html.mirrorCursorOnMatchingTag');
|
||||
disposable = activateMirrorCursor(matchingTagPositionRequestor, { html: true, handlebars: true }, 'html.mirrorCursorOnMatchingTag');
|
||||
toDispose.push(disposable);
|
||||
|
||||
disposable = client.onTelemetry(e => {
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
WorkspaceEdit
|
||||
} from 'vscode';
|
||||
|
||||
export function activateMatchingTagPosition(
|
||||
export function activateMirrorCursor(
|
||||
matchingTagPositionProvider: (document: TextDocument, position: Position) => Thenable<Position | null>,
|
||||
supportedLanguages: { [id: string]: boolean },
|
||||
configName: string
|
||||
@@ -173,10 +173,19 @@ function shouldDoCleanupForHtmlAttributeInput(document: TextDocument, firstPos:
|
||||
|
||||
const primaryBeforeSecondary = document.offsetAt(firstPos) < document.offsetAt(secondPos);
|
||||
|
||||
/**
|
||||
* Check two cases
|
||||
* <div |></div >
|
||||
* <div | id="a"></div >
|
||||
* Before 1st cursor: ` `
|
||||
* After 1st cursor: `>` or ` `
|
||||
* Before 2nd cursor: ` `
|
||||
* After 2nd cursor: `>`
|
||||
*/
|
||||
return (
|
||||
primaryBeforeSecondary &&
|
||||
charBeforePrimarySelection === ' ' &&
|
||||
charAfterPrimarySelection === '>' &&
|
||||
(charAfterPrimarySelection === '>' || charAfterPrimarySelection === ' ') &&
|
||||
charBeforeSecondarySelection === ' ' &&
|
||||
charAfterSecondarySelection === '>'
|
||||
);
|
||||
Reference in New Issue
Block a user