redhat-developer / redhat-developer/lsp4ij

Scala-metals integration: double clicking any language keyword (e.g. def/var/import) will cause the enclosing definition paragraph to be selected

Open
#1,179 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug selectionRange
Dominant language
Java
Stars
344
Forks
113
Avg merge
5h 22m
Merged PRs (30d)
15

Description

This is only observed on scala, other languages using LSP are file

Image

conventionally, selecting paragraph should be reserved for triple-click

I exported the LSP communication and can't see cause of this behaviour, so I assume it is a plugin error:

[Trace - 17:39:18] Sending request 'textDocument/documentHighlight - (30)'.
Params: {
  "textDocument": {
    "uri": "file:///home/peng/git-release/scalatestplus-junit5/src/test/scala/org/scalatestplus/junit5/ScalaTestEngineIntegration.scala"
  },
  "position": {
    "line": 47,
    "character": 3
  }
}


[Trace - 17:39:18] Received response 'textDocument/documentHighlight - (30)' in 0ms.
Result: []


[Trace - 17:39:18] Sending request 'textDocument/documentHighlight - (31)'.
Params: {
  "textDocument": {
    "uri": "file:///home/peng/git-release/scalatestplus-junit5/src/test/scala/org/scalatestplus/junit5/ScalaTestEngineIntegration.scala"
  },
  "position": {
    "line": 51,
    "character": 0
  }
}


[Trace - 17:39:18] Received response 'textDocument/documentHighlight - (31)' in 0ms.
Result: []


[Trace - 17:39:18] Sending request 'textDocument/codeAction - (32)'.
Params: {
  "textDocument": {
    "uri": "file:///home/peng/git-release/scalatestplus-junit5/src/test/scala/org/scalatestplus/junit5/ScalaTestEngineIntegration.scala"
  },
  "range": {
    "start": {
      "line": 47,
      "character": 0
    },
    "end": {
      "line": 51,
      "character": 0
    }
  },
  "context": {
    "diagnostics": [],
    "triggerKind": 2
  }
}


[Trace - 17:39:18] Received response 'textDocument/codeAction - (32)' in 0ms.
Result: []


Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Reproduce the double-click behavior in a Scala file using Metals, then inspect the LSP client handling around the reported documentHighlight and codeAction requests to determine where paragraph selection is introduced. Done means a double-click selects only the word while triple-click still selects the paragraph.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.