Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Code actions fail to apply the TextEdits intermittently #40501

Open
malinthar opened this issue May 24, 2023 · 5 comments
Open

[Bug]: Code actions fail to apply the TextEdits intermittently #40501

malinthar opened this issue May 24, 2023 · 5 comments
Assignees
Labels
Area/CodeAction Language Server Code Actions Points/2 Equivalent to two days effort Priority/Low Status/Blocked Team/LanguageServer Language Server Implementation related issues. #Compiler Type/Bug userCategory/Editor

Comments

@malinthar
Copy link
Contributor

Description

I observed the above behaviour when I was trying to select a code action and apply the text edits. The text edits were not applied. I tried this for multiple times and then it worked. I don't have a specific scenario yet to reproduce this. But creating this issue to track the effort of reproducing and finding the cause for the behaviour.

Steps to Reproduce

No response

Affected Version(s)

No response

OS, DB, other environment details and versions

No response

Related area

-> Editor

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@malinthar malinthar added Type/Bug Team/LanguageServer Language Server Implementation related issues. #Compiler labels May 24, 2023
@ballerina-bot ballerina-bot added the needTriage The issue has to be inspected and labeled manually label May 24, 2023
@IMS94 IMS94 added Area/CodeAction Language Server Code Actions and removed needTriage The issue has to be inspected and labeled manually labels May 24, 2023
@malinthar malinthar changed the title [Bug]: Code actions fails to apply the TextEdits intermittently [Bug]: Code actions fail to apply the TextEdits intermittently May 30, 2023
@malinthar
Copy link
Contributor Author

malinthar commented May 30, 2023

I was able to reproduce the issue as depicted in the following capture.
code-action

When investigated could not find anything off(buggy) on the LS side that causes this. The codeActions() remote procedure's response is the same when its working(text-edits are applied) and not working. Therefore, this may be due to an issue in the plugin. Have to dig deep and figure out.

@malinthar malinthar moved this from BackLog to Planned for Sprint in Ballerina Team Main Board Jun 8, 2023
@malinthar malinthar added the Points/2 Equivalent to two days effort label Jun 8, 2023
@malinthar malinthar self-assigned this Jun 8, 2023
@malinthar malinthar moved this from Planned for Sprint to In Progress in Ballerina Team Main Board Jun 12, 2023
@malinthar malinthar moved this from In Progress to Planned for Sprint in Ballerina Team Main Board Jun 12, 2023
@malinthar malinthar moved this from Planned for Sprint to In Progress in Ballerina Team Main Board Jun 18, 2023
@malinthar malinthar added this to the 2201.7.0 milestone Jun 19, 2023
@malinthar
Copy link
Contributor Author

Pull module code action shows the same behaviour.
codeactions_issue

@malinthar
Copy link
Contributor Author

malinthar commented Jun 19, 2023

Pull module code action shows the same behaviour. codeactions_issue

This does not happen when there is 2 newlines in between the import statement and main function
code_actions_2

@malinthar
Copy link
Contributor Author

malinthar commented Jun 19, 2023

Figured out that the issue occurs only when the a code action is selected on a line of a code lens, (Run|Debug|Visualize) in the above case. When the code action is selected it also navigates to the closest line /token as depicted in #40501 (comment). I believe, this triggers a new textDocumentService/codeAction request cancelling the progression of the previous codeAction request. Have to investigate and figure out a solution for this.

@malinthar malinthar removed this from the 2201.7.0 milestone Jun 19, 2023
@malinthar malinthar moved this from In Progress to On Hold in Ballerina Team Main Board Jun 19, 2023
@malinthar
Copy link
Contributor Author

This seems to be a bug in VSCode. Releated issue microsoft/vscode#169854

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/CodeAction Language Server Code Actions Points/2 Equivalent to two days effort Priority/Low Status/Blocked Team/LanguageServer Language Server Implementation related issues. #Compiler Type/Bug userCategory/Editor
Projects
Status: On Hold
Development

No branches or pull requests

4 participants