redhat-developer / redhat-developer/vscode-java

auto completion inserting already-existing text ("overwrite" to the right)

Open
#3,312 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

code completion unnecessarily not "overwriting" to the right (Java specific? language specific fixes with compile-check "smarter" "smart" acceptSuggestion possible)

TLDR; just look below at image attachments (step 1, 2, 3)

at the basic, this isn't language specific, but language enhancements possible

"overwriting" or "contextual insert" or "surrounding check" or "duplicate surround text" might be a better term

Not sure where to file this at the "editor." level

filing in vscode-java for language specific completion enhancement ability (less so for compile check, mores to not overwrite text that is suppose to be repeated, but ymmv)

discussion

fixes would include:

  1. just don't write duplicate text
  2. a property with options (as its possibly "destructive", though I'd prefer the "destructive" option here)
  3. language specific fix (bonus: detect which actually compiles)

between image 2 and image 3, both [tab] and [enter] seem to have the same results, so maybe this could be considered in configuration (on tab, check/replace same surrounding text, on enter just insert)

tried following settings, no difference observed:

"editor.acceptSuggestionOnEnter": "smart",
"editor.acceptSuggestionOnEnter": "on",

wanted:

"editor.acceptSuggestionOnEnter": "overwrite" or ("replacesame"),
"java.completion.acceptReplaceMode": "compile"

or
"editor.acceptSuggestionSurroundMode": {
 "replaceSame": ,
}

Also, separately, but not,

  1. editor.suggest isn't ordering by preexisting surround text
  2. language-specific e.g. "java.completion.orderByPriorityStaticMode": "preexisting" surround check could handle ordering better
  3. bonus language-specific e.g. "java.completion.orderByPriorityCompileCheck": "true" surround check could handle ordering
Environment
  • Operating System: N/A
  • JDK version: N/A
  • Visual Studio Code version: 1.82.2
  • Java extension version: 1.22.1
  • Java Debugger extension version: N/A
Steps To Reproduce

Here's a simple setter-to-fluent workflow change, but I seem to hit this case of not looking at preexisting text to the right

vscode-completion1
vscode-completion2
vscode-completion3

Current Result

see image 3

Expected Result
  1. don't not overwrite the same text as is being replaced (no idea about ALL cases, but something could be done, but maybe language specific)
  2. property options on "surrounding smartness"
Additional Informations

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

Start by reproducing the setter-to-fluent workflow with the listed VS Code and vscode-java versions, comparing Tab and Enter and the specified suggestion settings. No source file or test is named, so first locate the editor completion acceptance behavior and its Java extension integration. Done means duplicate surrounding text is not inserted and the intended configuration or language-specific behavior is verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, typescript, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.