Proposal: Modifying PaperWM to utilize the benefits of TypeScript and LSP #800
Replies: 1 comment 4 replies
-
In general I wouldn't be opposed to this. I also thought about it in the past but I decided that there were to many problems. But if gnome now officially supports this and has a guide for it, it might be worth it. One issue that we will have if we move to typescript is that anyone that the extension will break for anyone that still has the extension installed through the git repo and pulls. But I think that is a minor issue now, since most people probably have it installed through EGO. Regarding the missing Do you have the code pushed somewhere? Then I might take another look at how much is still missing. |
Beta Was this translation helpful? Give feedback.
-
Context
I've been delving into the codes of PaperWM for some time now, trying to implement certain tweaks. However I'm having some difficulties in comprehending and modifying the codes. I've spent much time in navigating back and forth, trying to locate the declaration/initialization of a variable (e.g. its type and available fields) or to figure out the usage of a function or a class (e.g. arguments that an api accepts).
According to GJS Guid/TypeScript and LSP, it is now possible to develop gnome extensions with LSP support, so that editors would provide auto-completion, hover-documentation and diagnostics. I believe most of us are used to coding with code completions and diagnostic warnings so it should help.
Efforts & Problems
As I need the support of LSP for coding, I spared some time trying to let it work. I'm not an expert in TypeScript so what I can do is simply to follow the steps of the guide and to say "wow it works", then navigating to every diagnostic warning and trying to fix it. I renamed every
*.js
file to*.ts
and moved them into thesrc/
directory, and then tweaked a couple of files to eliminate their warnings. Mostly it works as expected:Code completion (screenshot)
API documentation (screenshot)
Still, there are pieces that I can't fix:
Undeclared imports (screenshot)
According to their source codes, I found that the file
utils.js
exists in GNOME Shell/js/misc while does not exist in Gjsify/gnome-shell/src/misc. So there are libraries that do exist in GNOME Shell and can be imported and used, but are not declared in@girs
modules.Next Steps
I believe it's possible to modify PaperWM to use TypeScript but there's still so much work to do. And I think there should be one who's proficient in it to lead this work. At least these tasks should be done in my eyes:
tsconfig.json
,makefile
, etc.install.sh
,uninstall.sh
, etc.*.js
to*.ts
and fix those LSP warnings, solving those undefined imports.I've put forward this proposal with the hope that it will be realized. However, upon further consideration, I recognized my limitations in overcoming all these challenges above. Looking forward to your ideas.
Beta Was this translation helpful? Give feedback.
All reactions