microsoft / microsoft/monaco-editor

[Bug] Rename popup for JS/TS private members does not include the `#` character

Open
#5,205 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Description

Reproducible in vscode.dev or in VS Code Desktop?
  • Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
Monaco Editor Playground Link

https://microsoft.github.io/monaco-editor/playground.html?source=v0.55.1#XQAAAAJQAQAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscwzS98RgmSaumWUF-TBOsVJ4S4FwfCDQb5-2uUHXTVAefbVSd9IzaZ_vv9VR9KugsKikU_wkLK9jT_o8SJzPv4k8g9Sb1c0Vhw1m9L2V6fITJixjKOWlQkasTOk0BKGvRJOQpwxIb5XQVsN9NClXRLqHLhHyOVXnz3_P8-kZ6F3fn06j7Tic3EGUaUHEQKzIn7jX0X_CWXbKf2_aI6WLoTJJPezM77MJ743Iklw8Zgl3J6iPXuJHLFtfDPDfEeq8UtvEvIaXPLgBg6R_7VlnTat76OG5W7-9CkFg

Monaco Editor Playground Code
const value = /* set from `myEditor.getModel()`: */ `class Foo {
	#test() {
		
	}
}`;

// Hover on each property to see its docs!
const myEditor = monaco.editor.create(document.getElementById("container"), {
	value,
	language: "javascript",
	automaticLayout: true,
});
Reproduction Steps

Put the cursor on the method name #test and press F2 to rename

Actual (Problematic) Behavior

The # is not included in the popup text field, which means after the rename the method/field might be accidentally made public if you forget to add the # back.

Image
Expected Behavior

The # is included in the text field like in VSCode:

Image
Additional Context

No response

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 with the Monaco Editor Playground reproduction and the F2 rename entry point for the JavaScript class containing #test. Trace how the rename popup text is populated for private members, then verify that the field retains the # and that renaming does not make the member public.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.