entity jump 只匹配变量名

This commit is contained in:
Pan Qiancheng 2024-10-20 21:53:59 +08:00
parent 6773b16420
commit 0786e36fdb
2 changed files with 2152 additions and 2661 deletions

File diff suppressed because it is too large Load Diff

View File

@ -38,7 +38,7 @@ function handleSelectionChange(event: vscode.TextEditorSelectionChangeEvent) {
}
const text = document.getText(selection);
const pattern = /entity:\s*(['"])(.*?)\1,/;
const pattern = /entity:\s*(['"])([a-zA-Z0-9_\s]+)\1,/;
const match = text.match(pattern);
if (match) {
@ -56,7 +56,7 @@ const entityProviders = {
{ scheme: 'file' },
{
provideHover(document, position, token) {
const pattern = /entity:\s*(['"])(.*?)\1,/;
const pattern = /entity:\s*(['"])([a-zA-Z0-9_\s]+)\1,/;
const range = document.getWordRangeAtPosition(
position,
pattern
@ -82,7 +82,7 @@ const entityProviders = {
document: vscode.TextDocument
): vscode.DocumentLink[] {
const links: vscode.DocumentLink[] = [];
const regex = /entity:\s*(['"])(.*?)\1,/g;
const regex = /entity:\s*(['"])([a-zA-Z0-9_\s]+)\1,/g;
const text = document.getText();
let match;
while ((match = regex.exec(text)) !== null) {