Skip to content

Feature Request: Turn Of Code Highlights for Classes unkown to Dart. #2241

Closed

Description

@digitalwert-developer

Since some Flutter and Dart Classnames can become quite Long I would like to request, that Classes which are not implemented won't be highlighted as Classes any longer.
This would make it easier to spot typos ( I type mostly faster than autocomplete reacts)
and to avoid wrong conclusions like following example:

class Baa{
};
class Foo<T  extends Baa> {
}
...
 var  myfoo = new Foo<Baar>() 

Why does Foo<T> doesnt accept my Baa class as a Type did i do something wrong in the template?
While the while problem lies in me writing Baar instead ..

So it would be nice to only highlight Words starting with a Capital Letter as Classes if they can be identified. Would that be possible? :)

Activity

  1. DanTup commented on Jan 30, 2020

    @DanTup
    Member

    This isn't currently possible, as the highlighting is done with TextMate grammars and has no access to type info. There's an open PR to move to server-based highlighting when VS Code finalises the API, however I'm not sure if the server highlights differentiate between resolved/unresolved classes either. If not, maybe using the new API we could use the diagnostics (errors) to apply additional colouring rules? I'll have to do some testing.

  2. added this to the v3.9.0 milestone on Jan 30, 2020
  3. added
    in editorRelates to code editing or language features
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    on Jan 30, 2020
  4. modified the milestones: v3.9.0, On Deck on Mar 11, 2020
  5. modified the milestones: On Deck, Backlog on Jul 2, 2020
  6. modified the milestones: On Deck, v3.18.0 on Dec 10, 2020
  7. DanTup commented on Dec 15, 2020

    @DanTup
    Member

    This will be achievable with the semantic token work in dart-lang/sdk@cb2ede5.

    In order to get the fix you'll need Dart-Code v3.18.0 (a preview release should be available later today/tomorrow), be using LSP Preview, and have a Dart SDK from after yesterday (the most recent nightly works, and of course the next releases of Dart/Flutter SDKs will include this).

    With all this active, you'll be able to override the colours supplied by the textMate grammar (for example here I've set classes that come from the grammar as red), and the Semantic Tokens will then be layered over the top (and re-color known classes as classes):

    Screenshot 2020-12-15 at 12 22 31

    (probably you'd just want a slightly faded colour or something though, rather than red).

    Note: The overridden colour will be used for all types until semantic tokens are available, so when you first open a file you'd see them all like that, and then they'd be updated once the token data arrived.

  8. DanTup commented on Dec 22, 2020

    @DanTup
    Member

    Due to some last minute issues, support for LSP 3.16 (which supports semantic tokens) won't be included in v3.18, but hopefully the next release after that.

  9. modified the milestones: v3.18.0, v3.19.0 on Dec 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in editorRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serveris enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions