Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scala CLI actionable diagnostics for using directives #1542

Closed
lwronski opened this issue Nov 5, 2022 · 2 comments
Closed

Scala CLI actionable diagnostics for using directives #1542

lwronski opened this issue Nov 5, 2022 · 2 comments
Labels

Comments

@lwronski
Copy link
Contributor

lwronski commented Nov 5, 2022

From the previous version of Scala CLI was introduced a new actionable diagnostic which can be turned on by running the command:

scala-cli config actions true

and to disable it users have to run:

scala-cli config actions false

It is integrated with metals with QuickFix actions:

Screen.Recording.2022-11-05.at.11.14.15.mov

It works only from the nightly version of Metals.

Describe the solution you'd like

For now, it is only available one actionable diagnostic for updating outdated dependencies. I created this issue to track other actionable diagnostics and collect some others ideas.

Some ideas for a new actionable diagnostics:

  1. Detect duplication of using directives in project and suggest users to have only one. For example in the project we should have only one using directive to specify scala version //> using scala.
  2. Suggest user to convert ivy and dep syntax to using directive. It should replace ivy/dep to //> using lib
@lwronski lwronski added the enhancement New feature or request label Nov 5, 2022
@ckipp01
Copy link
Contributor

ckipp01 commented Nov 20, 2022

One I just came across.

2022.11.20 20:01:24 INFO  BSP server: [warn] ./test.scala:1:1: This using directive is ignored. Using directive using plain comments are deprecated. Please use a special comment syntax: '//> ...' or '/*> ... */'
2022.11.20 20:01:24 INFO  BSP server: [warn] // using scala "2.13.10"
2022.11.20 20:01:24 INFO  BSP server: [warn] ^^^

Which under the hood looks like:

[Trace - 08:09:57 pm] Received notification 'build/publishDiagnostics'
Params: {
  "textDocument": {
    "uri": "file:///Users/ckipp/Documents/scratch-workspace/dependency-diagnostic-issue/test.scala"
  },
  "buildTarget": {
    "uri": "file:/Users/ckipp/Documents/scratch-workspace/dependency-diagnostic-issue/.scala-build/?id\u003dproject_bd2c96d2de-199b58dc22"
  },
  "diagnostics": [
    {
      "range": {
        "start": {
          "line": 0,
          "character": 0
        },
        "end": {
          "line": 0,
          "character": 3
        }
      },
      "severity": 2,
      "source": "scala-cli",
      "message": "This using directive is ignored. Using directive using plain comments are deprecated. Please use a special comment syntax: \u0027//\u003e ...\u0027 or \u0027/*\u003e ... */\u0027"
    }
  ],
  "reset": false
}

It'd be great to just have data here with the correct syntax (adding the >) so that Metals could just offer a quick fix to do this for the user.

@Gedochao
Copy link
Contributor

Suggest user to convert ivy and dep syntax to using directive. It should replace ivy/dep to //> using lib

to be tracked under #2622

Detect duplication of using directives in project and suggest users to have only one. For example in the project we should have only one using directive to specify scala version //> using scala.

to be tracked under #2634

Closing this, feel free to create separate tickets for future actionable diagnostics.

@Gedochao Gedochao closed this as not planned Won't fix, can't repro, duplicate, stale Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants