monaco-editor icon indicating copy to clipboard operation
monaco-editor copied to clipboard

[Question] how to know what completion item selected when i hit enter key or mouse down?

Open KamiC6238 opened this issue 3 years ago • 3 comments

Context

  • [X] This issue is not a bug report. (please use a different template for reporting a bug)
  • [X] This issue is not a duplicate of an existing issue. (please use the search to find existing issues)

Description

monaco version: 0.24.0

i need selected completion item to do something, but now i dont know how to get the selected completion item.

KamiC6238 avatar Aug 22 '22 10:08 KamiC6238

@KamiC6238 What is your use case? What are you trying to do when the user has selected something and hit the enter key?

rcjsuen avatar Aug 22 '22 13:08 rcjsuen

@KamiC6238 What is your use case? What are you trying to do when the user has selected something and hit the enter key?

hello @rcjsuen , i am writing a typing mode in monaco-editor like https://www.keybr.com/. In this mode, user can not typing a real charater in editor, and just change the cursor position.

In that use case, i will give suggestions for users, when user hit the enter key, i will calculate the position and change the cursor to the new position from the selected completion item.

but now i dont know how to get the completion item after hit the enter key.

KamiC6238 avatar Aug 22 '22 14:08 KamiC6238

In that use case, i will give suggestions for users, when user hit the enter key, i will calculate the position and change the cursor to the new position from the selected completion item.

So what they suggest does not matter? They will not edit the content? I do not understand why they would select something then.

rcjsuen avatar Aug 27 '22 10:08 rcjsuen