Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement semantic coloring #483

Merged
merged 4 commits into from
Jun 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"label": "watch-tmlanguage",
"type": "process",
"command": "node",
"args": ["${workspaceFolder}/packages/cadl-vscode/scripts/watch-tmlanguage.js"],
"args": ["${workspaceFolder}/packages/compiler/scripts/watch-tmlanguage.js"],
"problemMatcher": {
"base": "$msCompile",
"background": {
Expand All @@ -47,7 +47,7 @@
},
"isBackground": true,
"options": {
"cwd": "${workspaceFolder}/packages/cadl-vscode"
"cwd": "${workspaceFolder}/packages/compiler"
},
"presentation": {
"echo": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cadl-lang/compiler",
"comment": "Add semantic colorization",
"type": "minor"
}
],
"packageName": "@cadl-lang/compiler"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "cadl-vscode",
"comment": "Add semantic colorization",
"type": "minor"
}
],
"packageName": "cadl-vscode"
}
8 changes: 5 additions & 3 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 16 additions & 10 deletions packages/cadl-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,31 @@
"title": "Restart Cadl server",
"category": "Cadl"
}
],
"semanticTokenScopes": [
{
"scopes": {
"keyword": [
"keyword.other.cadl"
],
"macro": [
"entity.name.tag.cadl"
]
}
}
]
},
"scripts": {
"clean": "rimraf ./dist ./dist-dev ./temp",
"build": "npm run compile && npm run rollup && npm run generate-tmlanguage && npm run generate-language-configuration && npm run generate-third-party-notices && npm run package-vsix",
"build": "npm run compile && npm run rollup && npm run copy-tmlanguage && npm run generate-language-configuration && npm run generate-third-party-notices && npm run package-vsix",
"compile": "tsc -p .",
"watch": "tsc -p . --watch",
"watch-tmlanguage": "node scripts/watch-tmlanguage.js",
"dogfood": "node scripts/dogfood.js",
"generate-tmlanguage": "node scripts/generate-tmlanguage.js",
"copy-tmlanguage": "node scripts/copy-tmlanguage.js",
"generate-language-configuration": "node scripts/generate-language-configuration.js",
"generate-third-party-notices": "cadl-build-tool generate-third-party-notices",
"rollup": "rollup --config --failAfterWarnings 2>&1",
"package-vsix": "vsce package --yarn",
"test": "mocha",
"test-official": "mocha --forbid-only"
"package-vsix": "vsce package --yarn"
},
"dependencies": {},
"devDependencies": {
Expand All @@ -121,11 +130,8 @@
"mocha": "~9.2.0",
"rimraf": "~3.0.2",
"rollup": "~2.70.1",
"tmlanguage-generator": "~0.3.0",
"typescript": "~4.7.2",
"vsce": "~2.6.7",
"vscode-languageclient": "~8.0.0",
"vscode-oniguruma": "~1.6.1",
"vscode-textmate": "~6.0.0"
"vscode-languageclient": "~8.0.0"
}
}
6 changes: 6 additions & 0 deletions packages/cadl-vscode/scripts/copy-tmlanguage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { copyFile } from "fs/promises";

await copyFile(
"node_modules/@cadl-lang/compiler/dist/cadl.tmLanguage",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to compute the projectRoot and resolve relative to that instead of depending on the cwd

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. We have this in a few other scripts/. I'll fix them all together in follow-up PR.

"../cadl-vscode/dist/cadl.tmLanguage"
);
12 changes: 0 additions & 12 deletions packages/cadl-vscode/scripts/generate-tmlanguage.js

This file was deleted.

26 changes: 0 additions & 26 deletions packages/cadl-vscode/test/alias.test.ts

This file was deleted.

28 changes: 0 additions & 28 deletions packages/cadl-vscode/test/decorator.test.ts

This file was deleted.

109 changes: 0 additions & 109 deletions packages/cadl-vscode/test/interface.test.ts

This file was deleted.

Loading