I am looking for a way by which I can find out whether dart file(s) is properly documented (each class, its methods etc) according to DartDoc guidelines. Any type of solution will do. Like a python script which parses the file and looks for documentation or any custom dart linter that does the job.
I have no idea how to do such specific file parsing in Python or any scripting language. Neither was I able to find lint rule in dart analyzer that does so.
Any help or hint will be appreciated.
Related
I'm looking to improve my own productivity by trying to figure out how to provide cmd+click functionality for variables declared at runtime. I work with a library that allows you to register objects to it at runtime to be accessed later — it would be great if I could cmd+click to definitions of these! How do you think I could achieve this? I'm open to any ideas. Thanks!
Edit:
Thoughts I have so far inspired by feedback from various Slack communities:
There is no such thing as 'runtime' when providing functionality in IDEs
We need to be able to teach the IDE about what definitions to expect. Whether this means writing an extension to use the VS Code API specifically for my use-case, or otherwise working within a system that generates files that the IDE already knows to look for, which allows it to connect the dots and provide the precious peek / goto definition functionality
Edit:
I'm starting work on a VS Code extension that reads a dotfile for configuration — I'll share what I find out as I go!
I am totally new to creating extensions in VS Code, and all the official examples of extensions are written in Typescript/Javascript, which I have no experience with. Is it possible to create VS Code extensions in other languages, such as Python or C++?
If so, could anyone point me to any resources to get me started?
It is possible by creating a C++ module for Node.js, which can then be loaded like any other node module. Of course, some glue code written in JS or TS is necessary to register the extension and translate calls to/from vscode.
I've gone this way in my ANTLR4 extension, but gave up eventually, because of the troubles I had due to incompatible dependencies (you have to make sure the extension uses the exact same V8 version, which was used to build the underlying Node.js used by vscode, on all supported platforms).
This situation might have change, I don't know, but with that in the background I don't recommend it.
If you want to add support for a new language in vscode you can also write a separate language server, as is mentioned in the linked SO answer. For other type of work, I'm afraid, you have no alternative to use.
No, as #rioV8 said, since VSCode is an electron app and runs on Javascript.
I wrote a VS Code extension to support printing. Since all the recent issues have been concerned with issues relating to foreign character sets, it seems like I should support languages other than English.
But I can't find anything in on localisation in the VS Code API documentation. There's a section on languages but that's about parsing and syntax colouring etc for computer languages.
Is there any support or at least convention regarding localisation of VS Code extensions?
Thanks to Gama11 for pointing me at good resources.
Yes, this is possible, and there is actually a I18n sample extension for this:
https://github.com/microsoft/vscode-extension-samples/tree/master/i18n-sample
It's best if you read the readme, but the basic idea is the following:
use the vscode-nls-dev NPM package
use NLS identifiers such as "%extension.sayHello.title%" as placeholders for command titles and such in package.json
similarly, in JS code NLS identifiers can be translated with a localize() method imported from vscode-nls
have a toplevel i8n directory that contains the translations for those identifiers for the languages that are supported in <file-name>.i18n.json files
Alternatively, you could also take a look at how the C++ extension does it:
https://github.com/microsoft/vscode-cpptools/tree/master/Extension
They seem to take a slightly different approach: no i8n directory, but instead have the translations directly next to the file (package.nls.it.json, package.nls.zh-cn.json and package.nls.json with the default / English). I'm not sure if it translates anything outside of package.json / in JS code though.
The official l10n (localization) sample extension should help a lot, as the old i18n (internationalization) sample has been deprecated.
Clone it here: https://github.com/microsoft/vscode-extension-samples/tree/main/l10n-sample
From my extension, how can I access the abstract syntax tree that VS Code has for the active file? I have been looking through the API docs but haven't been able to find anything. I also came across this SO question but both the question and answer are pretty opaque to me.
There's no thing like a common AST for files loaded into an editor. In fact, many file aren't even parsed at all, unless an extension is installed which does that.
The linked answer describes a way to implement language support (via a language server), which is not the same as getting a fictional AST from vscode.
I'm looking into what would be the best option to extend VS code with an extension which add some more features to the JSON Format such as additional keyword highlighting.
What would be the best approach ?
Taking over the tmlanguage file for JSON and add additional options for eg syntax highlighting connected to a new language ?
"Extending" the JSON fomat ?
Custom linter ?
This looks my best bet I could find till now: Can a language in Visual Studio Code be extended?
Tnx in advance for giving advice what would be the best approach.
It depends on what features do you want and how much time you would like to spend on it.
If the syntax highlighting is the main purpose, just get a tmLanguage file for the programming language and use the official generator yocode to create an extension from it.
Visual Studio Code and Microsoft behind it are promoting the Language Server Protocol which may be the ultimate solution. And of course, it requires much more work.