mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
Fix #86058
This commit is contained in:
parent
c8eb6fd4aa
commit
2c20d011b1
|
@ -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 === '>'
|
||||
);
|
Loading…
Reference in a new issue