background
The project needs a JSON configuration file that uses fields exported from another typescrip file to reduce the chance of field name errors during coding.
Therefore, consider developing a plug-in for:
- The fn name is automatically completed in the JSON file
- Custom jump from a JAon file to a typescript file
- Intelligent prompt for error tilde lines in JSON files (tilde lines are displayed when the typescript file does not export this field)
Plugin effect:
implementation
Program source code
Automatic completion
Jump to definition
Intelligent diagnostics & tips
Key point: Use json-to-ast to convert a JSON file to an AST
Some hit the pit
- Executed when the plug-in is published
vsce publish
Times wrongERROR Failed request: (401)
The generated personal Access token permission is incorrect and should be selectedFull access
- Error reporting plugin release:
ERROR Make sure to edit the README.md file before you package or publish your extension
— Modify the project insideREADME.md
File (original file delete & rewrite) - Failed to create Publisher account using address — the network was limited.
-
The plug-in works in the local development environment, but does not respond (and does not report errors) when posted online.
Some NPM libraries are used in the project, but TSC is used to compile the plugin. In this case, some NPM library code in node_modules is not compiled. Webpack needs to be introduced for packaging & compilation
reference
- A comprehensive guide to VS Code plug-in development
- VS Code Document
- Some demo