Support environments with no tsconfig or jsconfig#1052
Support environments with no tsconfig or jsconfig#1052NullVoxPopuli wants to merge 2 commits intomainfrom
Conversation
|
Related issue with repro: #1051 |
cb0223f to
46d9524
Compare
6caf8b0 to
4d7883a
Compare
c9b20aa to
41a8dc2
Compare
evoactivity
left a comment
There was a problem hiding this comment.
Just a couple of things.
|
tried on windows with a brand new ember app based on [Activation] Activating Glint language server (Glint file detected).
Workspace ember-tsc not found (source: auto); using bundled ember-tsc from .../.vscode\extensions\typed-ember.glint2-vscode-1.0.3\node_modules\glint-ember-tsc-pack\bin\glint-language-server.js
typescript.configurePlugin not available; falling back to tsserver request. command 'typescript.configurePlugin' not found
Workspace ember-tsc not found; using bundled ember-tsc from .../.vscode\extensions\typed-ember.glint2-vscode-1.0.3\node_modules\glint-ember-tsc-pack\bin\glint-language-server.js
[Info - 10:22:14 PM] [Glint] Language server initializing.
[Info - 10:22:14 PM] [Glint] Workspace folders: file://.../my-app-name
[Info - 10:22:15 PM] [Glint] No TypeScript installation found from /dev/null.
[Warn - 10:22:15 PM] [Glint] Glint config not found for /dev/null/inferredProject1*; Glint features disabled. |
|
@void-mAlex but did your editor have the expected behavior? or no? |
|
once I added "@glint/ember-tsc": "^1.1.1",
"@glint/template": "^1.7.4",to the package json; pnpm installed; + reloaded dev window in vs code [Activation] Activating Glint language server (Glint file detected).
Using workspace ember-tsc from ...\my-app-name\node_modules\.pnpm\@glint+ember-tsc@1.1.1_typescript@5.9.3\node_modules\@glint\ember-tsc\bin\glint-language-server.js
typescript.configurePlugin not available; falling back to tsserver request. command 'typescript.configurePlugin' not found
|
|
@NullVoxPopuli |
|
Note for myself -- find a way to make this the default jsconfig for no-config situations: {
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"experimentalDecorators": true,
"skipLibCheck": true,
"strict": false,
"checkJs": false,
"noEmit": true,
"isolatedModules": true,
"allowImportingTsExtensions": false,
"resolveJsonModule": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"types": [
"ember-source/types",
"@embroider/core/virtual",
"vite/client",
"@glint/ember-tsc/types"
],
},
"exclude": ["dist", "node_modules"]
}from https://discord.com/channels/480462759797063690/1470939378871435557/1473088988561674324 |
This is exactly what I did on windows too, worked first time, no need to add deps manually. |
the extension doesn't activate without the packages which are not in the default bp for non ts projects - it says as much in the extension log |
|
do you two have different setups somehow? |
|
Presumably we do, mine is a clean vscode install on windows 11. It's not my dev machine, I just thought it was worth testing under windows so got it setup. |
|
when I tested on macOS, I only had Glint V2 installed 🤔 |
|
you need template syntax surely ... |
|
it's unrelated to ts/glint |
|
unrelated, sure, but you can't really use the ide without it, might as well go code in notepad at that point there wouoldn't be much difference |
|
what global packages do you have installed? wondering if that affects things as I have no such package especially ember-tsc/typescript |
|
I don't install things globally, so none 🎉 |
I see the same if I create a class component
I added @glint/template and @glint/ember-tsc and then I saw the problem @void-mAlex sees, because the updates you've added will not be used if a workspace copy of @glint/ember-tsc is available, since that package on npm is not updated with these changes.
|
| public configForDirectory(directory: string): GlintConfig | null { | ||
| let ts = findTypeScript(directory); | ||
| if (!ts) { | ||
| this.log(`No TypeScript installation found from ${directory}.`); | ||
| return null; | ||
| } |
There was a problem hiding this comment.
If typescript is not installed in the project none of the following code runs.
If you remove return null we end up with breakage,.
Adding typescript then makes it run, and in volar labs I can see the virtual file, but we still end up with any types in the template.
A combination of typescript, @glint/ember-tsc (with the glint config setting telling vscode to use the bundled copy) and this jsconfig.js file makes things work
{
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "bundler",
}
}I don't have time now to keep digging.









This tweaks the logic for when glint should activate (which has to happen independent of opening a file (for vscode reasons))
To test it out:
glint2-vscode-1.0.3-no-config.zip