The project I am working on at my work is using css-modules. However, it doesn't work well with css modules extension, because the project is using clojure. So I had to open CSS files whenever I had to fix something, which is somewhat irritating. So I made a Vscode extension to customize the Jump to definition feature
.
To customize language related features in vscode, check this document. In this project, I used vscode.languages.registerDefinitionProvider
API.
-
First, the extension is activated when it is a Clojure project.
-
When someone tries to
jump to definition
by hovering the mouse on some keywords, it provides the location of the definition based on the action I defined inCSSModuleDefinitionProvider
. -
When there are multiple definitions of the selected keyword, it shows definitions of the classname in the target CSS file.
I got a lot of inspiration from those two extentions to make this extension.