I am doing Flutter development and when I save, the code get formatted. It is nice but some settings are not what I want. For example, I would like to add a space after and before curly brace for my constructor:
Before
Device({this.deviceType});
After
Device({ this.deviceType });
How can I adjust Dart formatting or VS Code to handle that?
Thanks
You can't configure dartfmt, the Dart formatter, to do this as it's intended to make all Dart code look the same regardless of the author. See the FAQ of package:dart_style (the backend of dartfmt) for more information as to why the formatter isn't configurable.
The Dart formatter respects linter style rules as laid out in the "analysis_options.yaml" file. A description of the file can be found here. A complete list of linter rules can be found here.
You can also subscribe to common style guides, such as pedantic, a package with the style guide used internally by Google, or lint, another package that enables all the rules that aren't either contradictory or opinionated.
Related
I've created a custom language extension for my own script language. I've written a tmlanguage file to tokenize my script and do custom highlighting. I created a hover-provider that currently only shows the word that is hovered for testing the provider itself. I want to react on the textmate scopes of the current position in this hover, like the vs code Developer tool "Inspect Editor Token and Scopes" does.
At the end I want to react to one particular scope whose value I want to read and show a corresponding image of this value in the hover.
Fore example a line in my script could look like:
setImage(dic_1/dic_2/testImg)
Now I want to show the image that correlates with the path in the brackets if I hover over it.
I tried to find something in the documentation (https://code.visualstudio.com/api/references/vscode-api#languages) if there is something that would help me but couldn't see anything related.
I tried to ask ChatGPT for help after he suggested "possible internal and not public available methods" it suggested to create a custom hover provider with the help of the library "oniguruma" and tokenize the document again.
However, this feels a bit like an overkill. If vscode has a internal tool that does return the textmate scopes I would guess there is a easy way to access those tokens.
I found this thread (Is there a way to find the textmate scope from within my VSCode extension language functions?) but I don't rally understand why I need to write another parser.
Is there any way to access this textmate scopes in a hover-provider?
I have actually spent a lot of time looking for a solution for this. Stackoverflow is my last resort. Before I dive in I would like to describe my requirements.
My requirements,
I need an editor like slack that automatically converts markdown to relevant TextStyle or html. For example if I type, ## Hello and press enter. it is styled as H2 styled text.
Moreover, I also need to show a dropdown whenever I press # or # to select from a list of options.
In short, I need something like quip, slite or medium.
I was hoping that this will be easy in flutter, given half of these features are already there in Google's Gmail and other apps by google by havent yet found a single library that meets these requirements.
What I have already tried?
Quil: I found out by flutter_quill but for that I have to stick to a toolbar on the top. And no mentions support.
Zefyr and html_editor: I have tried these, but they are very buggy and slow. Moreover, they have very limited documentations.
Custom Flutter: Medium-like Text Editor. This is the most promising solution but it is lacking one essential feature of text editor. The article proposes that I divide the entire input field into multiple text fields which I can control using state. But this has one big problem that is, what if I want to select the entire body of text. Any hacks on this will be well appreciated.
If you have any questions and if the question isn't clear enough, please free to comment down below.
I wanted to enable internationalization in my app. I am already using getx so i am going to use it to enable internationalization. However i had a confusion, in the getx page, there are these many languages that it supports. I was wondering if i would have to give a Translations class with the strings i want to only convert to these languages or would getx automatically do it for me. In other words, would i have to provide strings for these languages too, or will my text automatically be translated to these languages by getx
These languages are available for Getx readme file and if you click on them you will see a readme in that language,
You must provide the translated strings to Getx material app.
You can use google translate, Excel, or this VS Code extension to translate strings automatically
For my debugger extension I'd like to implement a functionality from the following image where a step can ask a debugger client to show an inlined text with the result of the step.
I've read the DAP documentation thoroughly but still don't have a clue how this can be implemented or if it's even possible to implement. What request or event do I have to implement?
By the way, how is this function of debbuger client called?
With vscode v1.54, see Inline value provider
Today the Show Inline Values feature of VS Code's debugger is based on
a generic implementation in VS Code core, and doesn't provide
customizability through settings or extensibility via extensions. As a
consequence, it is not a perfect fit for all languages and sometimes
shows incorrect values because it doesn't understand the underlying
source language. For this reason, we are working on an extension API
that allows to replace the built-in implementation completely or to
replace parts of the implementation with custom code.
In this milestone we've made a first implementation of the proposed
API available.
And much more at the first link including sample code. So vscode is adding a true API for inline values rather than depending on Decorations anymore.
I am building a VSCode theme.
Currently im trying to change the behaviour for links, but I can't find the right setting. In my current theme file, there is no statement in tokenColors that seems to change anything. There is also no fontStyle: "underline" or something similar, yet a link like http://www.google.com is underlined.
I looked at it with the built in developer inspector (Developer: Inspect TM Scopes), but it only says:
string.quoted.docstring.multi.python
source.python
Where does the underline setting come from? How do I change the format for links?
There are two types of underlined links:
Link parsed from grammars. These would have a foo.link.language type scope
Links detected by a link detector
For links in the grammar, you can theme the link scope as normal.
You cannot directly theme links that come from the link detector. The "editorLink.activeForeground" ui theme property lets you theme the link when it is active, but you cannot theme a non-active link if it does not have a grammar scope associated with it.
For python specifically, the grammar likely need to be updated to parse the links. This can be done either by modifying the grammar or with an injection grammar