chiragpat / vscode-glimmer Goto Github PK
View Code? Open in Web Editor NEWVSCode extension for glimmer components
License: MIT License
VSCode extension for glimmer components
License: MIT License
Hello!! Great plugin!
I was wondering if it makes sense to migrate the plugin to https://github.com/glimmerjs to collocate with the runtime and future changes?
This would be similar to https://github.com/sveltejs/language-tools where they offer a language server and editor plugins.
Somehow creating a new syntax for glimmer-ts
and glimmer-js
causes slight differences even though they extend from js and ts. I attempted to port the changes made by @dfreeman here to https://github.com/lifeart/vsc-ember-syntax and saw the same issues appear.
What I've spotted so far and if a fix is found
I believe this is when used with the glint-language-server
, I don't think it provides the semanticTokenScopes
required to apply the correct colours ontop of the syntax highlighting.
Typescript Language Server provides semantic tokens here https://github.com/microsoft/vscode/blob/main/extensions/typescript-language-features/src/languageFeatures/semanticTokens.ts
@dfreeman Do you have any idea why they would not get passed down from TS -> Glint?
Incorrect | Correct |
---|---|
![]() |
![]() |
![]() |
![]() |
Solution
Not sure
Incorrect | Correct |
---|---|
![]() |
![]() |
PR #13
So, given this file
// syntaxes/glimmer-ts.json
{
"scopeName": "source.gts",
"patterns": [{ "include": "source.ts" }]
}
If I make it so source.ts
is broken like source.bla
all highlighting except for some suspect characters is removed.
These extra colours come from having this setting turned on.
The arrow function >
being red is down to that setting and gives a reason for #5 occuring
To fix that we need to add the following to the glimmer-ts and glimmer-js grammars in the package.json.
"unbalancedBracketScopes": [
"keyword.operator.relational",
"storage.type.function.arrow",
"keyword.operator.bitwise.shift",
"meta.brace.angle",
"punctuation.definition.tag",
"keyword.operator.assignment.compound.bitwise.ts"
]
If I reload the window, very breifly I can see the code folding arrows I'd expect then it switches to only offering folding for the template tag and it's contents.
This seems to be related to running ember-language-server. Tracking lifeart/vscode-ember#43
Incorrect | Correct |
---|---|
![]() |
![]() |
Set editor.foldingStrategy
to indentation
in settings.
"[glimmer-js]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.foldingStrategy": "indentation"
},
"[glimmer-ts]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.foldingStrategy": "indentation"
},
Solution
Ember Language Server to provide a js/ts folding
If a comment includes an @
symbol, the highlighting changes for that word
Incorrect | Correct |
---|---|
![]() |
![]() |
PR #15
The handlebars extension was causing this, merging #15 and disabling that extension will fix the issue.
I think since the files are glimmer-ts
files and not typescript
files, eslint doesn't know to run
Incorrect | Correct |
---|---|
![]() |
![]() |
Need to add glimmer-ts
and glimmer-js
to eslint.validate
.
// .vscode/settings.json
{
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"html",
"vue",
"markdown",
"glimmer-ts",
"glimmer-js"
],
"eslint.rules.customizations": [
{ "rule": "*", "severity": "warn" },
]
}
Organise Imports
option from typescript which is not available on glimmer-*
files.<template>
tags, possibly because html-language-server is not running for embedded handlebars@dfreeman @chiragpat any ideas?
Hi @chiragpat!
I like how you extension implement syntax highlighting for .js/.ts
files!
I have new .hbs
syntax highlighting addon, and trying to figure out, how we can cooperate and use same syntax highlighting or kinda.
https://marketplace.visualstudio.com/items?itemName=lifeart.vscode-glimmer-syntax
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.