-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
Add typechecking for TypeScript #946
Conversation
With the recent commits, the first issue #1 is fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So about the types - I think they should be part of Workbench, not of the project.
The reason for that is that they are "tied" to the environment Workbench provides.
Can you look into passing a custom path for the types to typescript-language-server
and pointing to the directory in /usr/share
?
In a way that we don't need setupTypeScriptProject
anymore.
For Rust and the cargo file it's a bit different - I don't 100% remember why we did it this way but I recall there were good reasons
Ideally in the future, types will be part of org.gnome.Sdk
and we won't need a copy in Workbench anymore.
I think the correct way is to change the |
Note from our discussion: tsconfig can remain part of the project for now if that's easier and we can revisit that later |
currently they don't work for some reason, and it's better to declare it as `any` for now
CI seems to be failing because of the Freedesktop SDK 24.08beta situation |
Co-authored-by: Sonny <[email protected]>
This is a draft because there are 3 outstanding issues:
1. It seems the typechecking really works when you open a previously-saved projectI believe this is because when you open a new project and switch to typescript, the
setupTypeScriptProject
will copy the necessary files and folders (tsconfig.json
,types/ambient.d.ts
andgi-types/*
) to the project. The language server doesn't know that the "project changed" (newly created files) so it won't see the various type augmentations.The fix could be as easy as to kill and spawn a new language server, but I'm not sure if that would be the right approach.
2. The
globalThis.workbench
types aren't there yetWorking on it 🚀
3. Generated gi.d.ts files require setting the path to include them
The generated types from
gi-typescript-definitions
have peculiar imports. They import each other as if they are all globalThis doesn't work because unless you add the following to
tsconfig.json
However, this means that the typechecker will think all the types in
gi-types
are "global" types, hence you get completions from all types in thegi-types
folder.