Skip to content

Commit

Permalink
fix: highlight improvement, avoid invalid diagnostics, deps upgrades.
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanPiercey committed Jul 26, 2022
1 parent 78a4151 commit c748adc
Show file tree
Hide file tree
Showing 12 changed files with 722 additions and 525 deletions.
6 changes: 6 additions & 0 deletions .changeset/bright-windows-argue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"marko-vscode": patch
"@marko/language-server": patch
---

Upgrade dependencies.
5 changes: 5 additions & 0 deletions .changeset/metal-toes-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"marko-vscode": patch
---

Fix syntax highlighting for comma after a tag variable.
5 changes: 5 additions & 0 deletions .changeset/six-fans-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@marko/language-server": patch
---

Fix issue with displaying invalid diagnostics.
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"type": "npm",
"label": "build",
"script": "build",
"script": "build:dev",
"group": {
"kind": "build",
"isDefault": true
Expand Down
52 changes: 24 additions & 28 deletions clients/vscode/build.mts
Original file line number Diff line number Diff line change
@@ -1,34 +1,30 @@
import path from "path";
import { build } from "esbuild";
import { createRequire } from "module";
const require = createRequire(import.meta.url);
import { fileURLToPath } from "url";
const thisDir = path.dirname(fileURLToPath(import.meta.url));
const require = createRequire(thisDir);

await build({
bundle: true,
minifySyntax: true,
minifyWhitespace: true,
format: "cjs",
outdir: "dist",
outbase: "src",
platform: "node",
target: ["node14"],
sourcemap: "linked",
entryPoints: ["src/index.ts", "src/server.ts", "src/__tests__/index.ts"],
external: [
"vscode",
"@babel/plugin-transform-modules-commonjs",
"mocha",
"mocha-snap",
"fast-glob",
"tsx",
],
plugins: [
{
name: "vscode-css-languageservice-fix",
async setup(build) {
// alias vscode-css-languageservice to it's esm version
// the default is a UMD definition that's incompatible with esbuild.
const pkg = "vscode-css-languageservice/package.json";
bundle: true,
minifySyntax: true,
minifyWhitespace: true,
absWorkingDir: thisDir,
format: "cjs",
outdir: "dist",
outbase: "src",
platform: "node",
target: ["node14"],
sourcemap: "linked",
entryPoints: ["src/index.ts", "src/server.ts", "src/__tests__/index.ts"],
external: ["vscode", "mocha", "mocha-snap", "fast-glob", "tsx"],
plugins: [
{
name: "vscode-css-languageservice-fix",
async setup(build) {
// alias vscode-css-languageservice to it's esm version
// the default is a UMD definition that's incompatible with esbuild.
const pkg = "vscode-css-languageservice/package.json";

build.onResolve({ filter: /^vscode-css-languageservice$/ }, () => ({
path: path.join(
Expand All @@ -39,5 +35,5 @@ await build({
}));
},
},
],
});
]
});
2 changes: 1 addition & 1 deletion clients/vscode/src/__tests__/diagnostics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { updateTestDoc } from "./setup.test";

describe("diagnostics", () => {
// Ensure we wait for any pending diagnostics to be sent.
before(() => timers.setTimeout(600));
before(() => timers.setTimeout(1800));
it("missing tag end", async () => {
await snap.inline(() => diagnostic("<span>"), `Missing ending "span" tag`);
});
Expand Down
2 changes: 1 addition & 1 deletion clients/vscode/syntaxes/marko.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@
"name": "meta.embedded.ts",
"contentName": "source.ts",
"begin": "/(?![/*])",
"end": "(?=[;(|/>]|:?=|\\s+[^:]|$)",
"end": "(?=[,;(|/>]|:?=|\\s+[^:]|$)",
"beginCaptures": {
"0": { "name": "punctuation.separator.tag-variable.marko" }
},
Expand Down
Loading

0 comments on commit c748adc

Please sign in to comment.