Skip to content

Commit ab7e60f

Browse files
committed
fix: improve concise mode highlighting
1 parent eb7fda7 commit ab7e60f

File tree

5 files changed

+21
-9
lines changed

5 files changed

+21
-9
lines changed

.changeset/fancy-bobcats-shout.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@marko/language-server": major
3+
"@marko/type-check": major
4+
"marko-vscode": major
5+
---
6+
7+
Improve import tag shorthand regexp false positives.

.changeset/funny-ties-lay.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"marko-vscode": patch
3+
---
4+
5+
Fix syntax highlighting of nested closing bracketed section in concise mode.

packages/language-server/src/ts-plugin/host.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type ts from "typescript/lib/tsserverlibrary";
1010

1111
const fsPathReg = /^(?:[./\\]|[A-Z]:)/i;
1212
const modulePartsReg = /^((?:@(?:[^/]+)\/)?(?:[^/]+))(.*)$/;
13-
const importTagReg = /<([^>]+)>/;
13+
const importTagReg = /^<([^>]+)>$/;
1414

1515
export interface ExtractedSnapshot extends Extracted {
1616
snapshot: ts.IScriptSnapshot;

packages/type-check/src/run.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const getCanonicalFileName = ts.sys.useCaseSensitiveFileNames
3838
? (fileName: string) => fileName
3939
: (fileName: string) => fileName.toLowerCase();
4040
const fsPathReg = /^(?:[./\\]|[A-Z]:)/i;
41-
const importTagReg = /<([^>]+)>/;
41+
const importTagReg = /^<([^>]+)>$/;
4242
const modulePartsReg = /^((?:@(?:[^/]+)\/)?(?:[^/]+))(.*)$/;
4343
const isRemapExtensionReg = /\.ts$/;
4444
const isSourceMapExtensionReg = /\.map$/;

packages/vscode/syntaxes/marko.tmLanguage.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@
382382
{
383383
"comment": "Concise Marko html-comment tag",
384384
"begin": "^(\\s*)(?=html-comment\\b)",
385-
"while": "(?=^(?:[})\\]`]|\\*/|\\s*$|\\1\\s+(\\S|$)))",
385+
"while": "(?=^(?:\\s*[})\\]`]|\\*/|\\s*$|\\1\\s+(\\S|$)))",
386386
"patterns": [
387387
{ "include": "#concise-open-tag-content" },
388388
{ "include": "#concise-comment-block" },
@@ -392,7 +392,7 @@
392392
{
393393
"comment": "Concise style tag less",
394394
"begin": "^(\\s*)(?=(?:html-)?style\\b[^\\s]*\\.less\\b)",
395-
"while": "(?=^(?:[})\\]`]|\\*/|\\s*$|\\1\\s+(\\S|$)))",
395+
"while": "(?=^(?:\\s*[})\\]`]|\\*/|\\s*$|\\1\\s+(\\S|$)))",
396396
"patterns": [
397397
{ "include": "#concise-open-tag-content" },
398398
{ "include": "#concise-style-block-less" },
@@ -402,7 +402,7 @@
402402
{
403403
"comment": "Concise style tag scss",
404404
"begin": "^(\\s*)(?=(?:html-)?style\\b[^\\s]*\\.scss\\b)",
405-
"while": "(?=^(?:[})\\]`]|\\*/|\\s*$|\\1\\s+(\\S|$)))",
405+
"while": "(?=^(?:\\s*[})\\]`]|\\*/|\\s*$|\\1\\s+(\\S|$)))",
406406
"patterns": [
407407
{ "include": "#concise-open-tag-content" },
408408
{ "include": "#concise-style-block-scss" },
@@ -412,7 +412,7 @@
412412
{
413413
"comment": "Concise style tag js/ts",
414414
"begin": "^(\\s*)(?=(?:html-)?style\\b[^\\s]*\\.[tj]s\\b)",
415-
"while": "(?=^(?:[})\\]`]|\\*/|\\s*$|\\1\\s+(\\S|$)))",
415+
"while": "(?=^(?:\\s*[})\\]`]|\\*/|\\s*$|\\1\\s+(\\S|$)))",
416416
"patterns": [
417417
{ "include": "#concise-open-tag-content" },
418418
{ "include": "#concise-script-block" },
@@ -422,7 +422,7 @@
422422
{
423423
"comment": "Concise style tag",
424424
"begin": "^(\\s*)(?=(?:html-)?style\\b)",
425-
"while": "(?=^(?:[})\\]`]|\\*/|\\s*$|\\1\\s+(\\S|$)))",
425+
"while": "(?=^(?:\\s*[})\\]`]|\\*/|\\s*$|\\1\\s+(\\S|$)))",
426426
"patterns": [
427427
{ "include": "#concise-open-tag-content" },
428428
{ "include": "#concise-style-block" },
@@ -432,7 +432,7 @@
432432
{
433433
"comment": "Concise script tag",
434434
"begin": "^(\\s*)(?=(?:html-)?script\\b)",
435-
"while": "(?=^(?:[})\\]`]|\\*/|\\s*$|\\1\\s+(\\S|$)))",
435+
"while": "(?=^(?:\\s*[})\\]`]|\\*/|\\s*$|\\1\\s+(\\S|$)))",
436436
"patterns": [
437437
{ "include": "#concise-open-tag-content" },
438438
{ "include": "#concise-script-block" },
@@ -442,7 +442,7 @@
442442
{
443443
"comment": "Normal concise tag",
444444
"begin": "^([ \\t]*)(?=[a-zA-Z0-9_$@.#])",
445-
"while": "(?=^(?:[})\\]`]|\\*/|\\s*$|\\1\\s+(\\S|$)))",
445+
"while": "(?=^(?:\\s*[})\\]`]|\\*/|\\s*$|\\1\\s+(\\S|$)))",
446446
"patterns": [
447447
{ "include": "#concise-open-tag-content" },
448448
{ "include": "#content-concise-mode" }

0 commit comments

Comments
 (0)