Skip to content

Named constructor token color is broken with LSP #3374

Closed

Description

@robertpiosik

Describe the bug
Named constructor's token color is broken with LSP.

To Reproduce
Use the default theme, enable LSP.

Expected behavior
Named constructor's token should be painted with a color of a method.

Screenshots
LSP:
image
Without LSP:
image

With LSP:
image
Without LSP:
image

Here is how GitHub colours these tokens:

@freezed
abstract class NoteFormEvent with _$NoteFormEvent {
  const factory NoteFormEvent.initialized(Option<Note> initialNoteOption) =
      _Initialized;
  const factory NoteFormEvent.bodyChanged(String bodyStr) = _BodyChanged;
  const factory NoteFormEvent.colorChanged(Color color) = _ColorChanged;
  const factory NoteFormEvent.todosChanged(KtList<TodoItemPrimitive> todos) =
      _TodosChanged;
  const factory NoteFormEvent.saved() = _Saved;
}
@injectable
class AuthBloc extends Bloc<AuthEvent, AuthState> {
  final IAuthFacade _authFacade;

  AuthBloc(
    this._authFacade,
  ) : super(const AuthState.initial());

  @override
  Stream<AuthState> mapEventToState(
    AuthEvent event,
  ) async* {
    yield* event.map(
      authCheckRequested: (e) async* {
        final userOption = _authFacade.getSignedUser();
        yield userOption.fold(
          () => const AuthState.unauthenticated(),
          (_) => const AuthState.authenticated(),
        );
      },
      signedOut: (e) async* {
        await _authFacade.signOut();
        yield const AuthState.unauthenticated();
      },
    );
  }
}

Versions (please complete the following information):

  • VS Code version: 1.56.2 (Universal)
  • Dart extension version: 3.22.0
  • Dart/Flutter SDK version: 2.13.0 (stable)

Activity

  1. added this to the v3.24.0 milestone on Jun 1, 2021
  2. added
    in editorRelates to code editing or language features
    in lsp/analysis serverSomething to be fixed in the Dart analysis server
    on Jun 1, 2021
  3. DanTup commented on Jun 1, 2021

    @DanTup
    Member

    I've got a fix for review at https://dart-review.googlesource.com/c/sdk/+/201831/ that will map constructor names like methods instead of classes:

    Screenshot 2021-06-01 at 13 00 43

    They're also tagged with a custom modifier (constructor) to allow customising them different to standard methods if desired.

  4. DanTup commented on Jun 1, 2021

    @DanTup
    Member

    Fixed by dart-lang/sdk@10b83a4. Since the change is in the server, it will show up in a future SDK release rather than a Dart-Code release.

  5. changed the title [-]Factory method's token colour is broken with LSP[/-] [+]Named constructor token color is broken with LSP[/+] on Jun 5, 2021
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 bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions