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

Support more TypeScript LSP code actions #1171

Open
jgoux opened this issue Sep 27, 2024 · 2 comments
Open

Support more TypeScript LSP code actions #1171

jgoux opened this issue Sep 27, 2024 · 2 comments

Comments

@jgoux
Copy link

jgoux commented Sep 27, 2024

Is your feature request related to a problem? Please describe.

When using the Deno LSP vs the TypeScript LSP, I noticed that some code actions from the TypeScript LSP are not working with Deno:

{
  "deno.enable": true,
  "deno.lint": true,
  "editor.defaultFormatter": "denoland.vscode-deno",
  "editor.formatOnSave": true,
  "editor.codeActionsOnSave": {
    "source.fixAll.ts": "explicit",
    "source.removeUnused.ts": "explicit", // doesn't work
    "source.addMissingImports.ts": "explicit", // doesn't work
    "source.organizeImports.ts": "explicit"
  }
}

Describe the solution you'd like

Feature parity with Typescript LSP would be great. 👍

@dgreensp
Copy link

I haven't tried these code actions "on save," but I use them quite a bit while editing. If the text cursor is in just the right place (after a symbol that isn't imported, or after an unused import symbol), you will (often, but not always!) be given these code actions as options when you press Command-Period.

@zomchak-code
Copy link

@jgoux have you managed to get source.fixAll working? It doesn't work when I test it.

Here's minimal repro:

.vscode/settings.json

{
  "deno.enable": true,
  "deno.lint": true,
  "editor.codeActionsOnSave": {
    "source.fixAll": "always"
  }
}

deno.json

{
  "lint": {
    "rules": {
      "include": ["verbatim-module-syntax"]
    }
  }
}

type.ts

export type Type = unknown;

test.ts

import { Type } from "./type.ts";
let type: Type;

When I save test.ts

Expected outcome: import { Type } from "./type.ts"; gets changed to import type { Type } from "./type.ts";

Actual outcome: nothing changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants