question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Don't include `source` code action by default

See original GitHub issue

Marksman returns code action of the source kind (titled Create a Table of Contents) when editor asks for code actions without explicitly specifying any kinds.

For example editor make this request:

{
  "context": {
    "diagnostics": [],
    "triggerKind": 2
  },
  "range": {
    "end": {
      "character": 0,
      "line": 0
    },
    "start": {
      "character": 0,
      "line": 0
    }
  },
  "textDocument": {
    "uri": "file:///usr/local/workspace/sublime-packages/LSP/README.md"
  }
}

and marksman returns:

[
  {
    "edit": {
      "changes": {
        "file:///usr/local/workspace/sublime-packages/LSP/README.md": [
          {
            "newText": "<!--toc:start-->\n- [Installation](#installation)\n  - [Stable Version](#stable-version)\n  - [Development Version](#development-version)\n- [Getting started](#getting-started)\n- [Getting help](#getting-help)\n<!--toc:end-->\n\n",
            "range": {
              "end": {
                "character": 0,
                "line": 0
              },
              "start": {
                "character": 0,
                "line": 0
              }
            }
          }
        ]
      }
    },
    "isPreferred": false,
    "kind": "source",
    "title": "Create a Table of Contents"
  }
]

I don’t have any explicit description of expected behavior for this but based on VSCode primarily (and what we have mirrored in Sublime Text) it seems that the source code actions should not be returned unless specifically asked for by the editor. Not following this logic results in editor providing source diagnostics for every location in the file (since editors request diagnostics for the current selection/cursor position) which is non-ideal for those kind of code actions.

(This issue originated from the discussion in https://github.com/sublimelsp/LSP/issues/1846#issuecomment-1255150008)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
rchlcommented, Sep 24, 2022
0reactions
artempyanykhcommented, Oct 23, 2022

I found some time to check the behavior in other editors; unfortunately, neither nvim, nor helix, nor emacs/eglot provide code action kind, trigger kind when requesting code actions. Basically, whatever the spec has to say about only? in code action request, the actual behavior is idiosyncratic to a particular editor/LSP client.

I’m still planning to filter out non-quickfix code actions in st regardless.

👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use Github Release API to make a release without ...
I make source code releases for my libre software projects, uploading a source release tarball, and then I get bug reports saying "your...
Read more >
github - How do we avoid development files in the release?
Target: I want the release to contain only the relevant files: 1 Python script, 1 plugin file, 1 config file, 1 license file,...
Read more >
Is it possible to remove the default source zip and tar.gz ...
I created separate CI steps which properly pack up the source ZIP files, but can I remove the default assets automatically created by...
Read more >
Create release without source code assets (#282486)
GitLab should provide an option to create a release and exclude the source code assets, which are currently automatically added.
Read more >
Update on the future stability of source code archives and ...
A look at what happened on January 30, what measures we're putting in place to prevent surprises, and how we'll handle future changes....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found