Skip to content

Quick fix for ignoring lint rule is broken for external getters with existing DartDoc #4775

@navaronbracke

Description

@navaronbracke

Not sure if these quick fixes are provided by the analyzer, feel free to move this issue if that is the case

Describe the bug
When using the ignore quickfix, the ignore is put in the wrong place if there is DartDoc for an external getter

To Reproduce
Steps to reproduce the behavior:

  1. Given the code sample:
class Foo {  
  /// The uuid of the user.
  external String get UID;
}
  1. Select the quick fix Ignore constant_identifier_names for this line

Expected behavior

class Foo {
  /// The uuid of the user.
  external String get UID; // ignore: non_constant_identifier_names
}

or

class Foo {
  /// The uuid of the user.
  // ignore: non_constant_identifier_names
  external String get UID;
}

Actual behavior

class Foo {
  // ignore: non_constant_identifier_names
  /// The uuid of the user.
  external String get UID;
}

Due to the ignore line not being directly before the code, it is not picked up and the lint is not ignored.

Workspace Environment
Dart Code extension: 3.74.0
Flutter extension: 3.74.0 (not activated)

App: Visual Studio Code
App Host: desktop
Version: mac 1.82.3

Workspace type: Dart (LSP)

Dart (3.2.0-198.0.dev): /Users/navaronbracke/Documents/flutter/bin/cache/dart-sdk
Flutter (3.15.0-9.0.pre.4): /Users/navaronbracke/Documents/flutter

Output from 'dart info'

/Users/navaronbracke/Documents/flutter/bin/cache/dart-sdk/bin/dart info

If providing this information as part of reporting a bug, please review the information
below to ensure it only contains things you're comfortable posting publicly.

General info

  • Dart 3.2.0-198.0.dev (dev) (Mon Sep 25 13:02:54 2023 -0700) on "macos_x64"
  • on macos / Version 13.5.2 (Build 22G91)
  • locale is en-BE

Project info

  • sdk constraint: '^3.2.0-198.0.dev'
  • dependencies:
  • dev_dependencies: lints, test

Process info

Memory CPU Elapsed time Command line
3 MB 0.0% 08:01:51 dart devtools --machine --try-ports 10 --allow-embedding
778 MB 33.5% 01-03:23:02 dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.74.0
754 MB 53.0% 01-00:25:01 dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.74.0
509 MB 98.7% 05:55 dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.74.0
72 MB 0.0% 02:34 dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.74.0
Output from 'flutter doctor'

/Users/navaronbracke/Documents/flutter/bin/flutter doctor -v

[✓] Flutter (Channel master, 3.15.0-9.0.pre.4, on macOS 13.5.2 22G91 darwin-x64, locale en-BE)
    • Flutter version 3.15.0-9.0.pre.4 on channel master at /Users/navaronbracke/Documents/flutter
    • Upstream repository git@github.com:navaronbracke/flutter.git
    • FLUTTER_GIT_URL = git@github.com:navaronbracke/flutter.git
    • Framework revision f6f18d0688 (10 days ago), 2023-09-25 23:09:32 -0400
    • Engine revision 75950dc280
    • Dart version 3.2.0 (build 3.2.0-198.0.dev)
    • DevTools version 2.28.0-dev.12

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/navaronbracke/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/navaronbracke/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A240d
    • CocoaPods version 1.13.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.82.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.74.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 13.5.2 22G91 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 117.0.5938.149

[✓] Network resources
    • All expected network resources are available.

• No issues found!

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 bugrelies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions