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

Fix for outline tab not loading in case package-info.java file is present in the workspace in vscode #6642

Merged
merged 1 commit into from
Nov 15, 2023

Conversation

Achal1607
Copy link
Collaborator

Package range was not being calculated in the object sent to the client from the server due to that error was thrown in the client of undefined range.

Please see:
oracle/javavscode#23

After fix:
outline_var2


^Add meaningful description above

By opening a pull request you confirm that, unless explicitly stated otherwise, the changes -

  • are all your own work, and you have the right to contribute them.
  • are contributed solely under the terms and conditions of the Apache License 2.0 (see section 5 of the license for more information).

Please make sure (eg. git log) that all commits have a valid name and email address for you in the Author field.

If you're a first time contributor, see the Contributing guidelines for more information.

If you're a committer, please label the PR before pressing "Create pull request" so that the right test jobs can run.

@Achal1607 Achal1607 changed the title Fix for outline tab not loading in case pacakge-info.java file is present in the workspace in vscode [JAVAVSCODE-23] Fix for outline tab not loading in case pacakge-info.java file is present in the workspace in vscode Oct 31, 2023
@neilcsmith-net neilcsmith-net changed the title [JAVAVSCODE-23] Fix for outline tab not loading in case pacakge-info.java file is present in the workspace in vscode Fix for outline tab not loading in case package-info.java file is present in the workspace in vscode Oct 31, 2023
@neilcsmith-net neilcsmith-net added the do not merge Don't merge this PR, it is not ready or just demonstration purposes. label Oct 31, 2023
@neilcsmith-net neilcsmith-net added this to the NB20 milestone Oct 31, 2023
@neilcsmith-net neilcsmith-net added the Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) label Oct 31, 2023
@neilcsmith-net
Copy link
Member

cc/ @lahodaj @MartinBalin opened against delivery - please take a look with respect to NB20. What is the impact for the IDE here?

@lahodaj
Copy link
Contributor

lahodaj commented Oct 31, 2023

Let me take a step back. So, the LSP server produces documentSymbols, and when there's a package-info, the document symbols contain also an entry for the package (with sub-elements), with broken positions. The broken positions then cause the Outline view to not work.

So, we need to do something about the package in the Outline. There are three variants:

  • variant 1: have the package at the same level as top-level classes. Seems this was the behavior at some point in the past, based on my reading of the history.
  • Outline view: var1-outline;
  • breadcrumbs when the caret is in the main method: var1-breadcrumbs
  • variant 2: have the package enclose the top-level classes. Would make some sense, but seems to break breadcrumbs. This is actually what the patch in this PR does.
  • Outline view: var2-outline
  • breadcrumbs when caret is in the main method: var2-breadcrumbs
  • variant 3: do not show the package in Outline (this is what basically happens today, if the Outline words)
  • Outline view: var3-outline
  • breadcrumbs when caret is in the main method: var3-breadcrumbs

I think variant 2 is disqualified, as it breaks the breadcrumbs. I don't have a strong opinion on decision between variant 1 and variant 3 - I wonder if @dbalek or @MartinBalin have some opinions here.

Regarding how does this affect the IDE - the NetBeans Swing UI is not affected at all, AFAIK. The ASF VS Code extension is affected I think, but has been for quite some time, I believe.

I personally don't see a strong need to push for integrating to NB 20. I personally think this can be "backported" to the Java Platform Support extension if needed.

@MartinBalin
Copy link
Contributor

I'm in favour of not showing package in outline view. Just fix it as Dusan found there is some invalid position sent over LSP when there is package-info.java. Fix this and not push it to 20.

@mbien mbien added the VSCode Extension [ci] enable VSCode Extension tests label Oct 31, 2023
@neilcsmith-net neilcsmith-net removed this from the NB20 milestone Oct 31, 2023
@neilcsmith-net neilcsmith-net changed the base branch from delivery to master October 31, 2023 19:45
@neilcsmith-net
Copy link
Member

OK, moved off delivery to master, and removed milestone. That brought in two commits that haven't reached master yet, so depending on what happens with this, please make sure not to merge those commits into master early!

@Achal1607
Copy link
Collaborator Author

If I can add something here, Java Redhat extension which is widely used as language support in vscode is showing code outline as shown in variant 1, since users would already be familiar with that sort of outline pattern, in my opinion it would be great if we can keep variant 1 as code outline pattern which follows redhat style (since users migrating from redhat extension would be in considerable number).

@lahodaj
Copy link
Contributor

lahodaj commented Nov 3, 2023

@Achal1607, I think I am fine with variant 1, but please note the current patch implements variant 2, as hence needs to be changed to implement variant 1.

Copy link
Contributor

@lahodaj lahodaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sensible to me, but please tweak the history to remove the extraneous commits (I thought these would disappear, but they don't seem to - unclear why). Thanks!

…sent in the workspace in vscode

Signed-off-by: Achal Talati <achal.talati@oracle.com>
@mbien
Copy link
Member

mbien commented Nov 6, 2023

VSCodeExt job fails even after restart:

test-vscode-ext:
     [exec] 
     [exec] > apache-netbeans-java@0.1.0 test
     [exec] > node ./out/test/runTest.js
     [exec] 
     [exec] node:events:495
     [exec]       throw er; // Unhandled 'error' event
     [exec]       ^
     [exec] 
     [exec] Error: read ECONNRESET
     [exec]     at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20)
     [exec] Emitted 'error' event on ClientRequest instance at:
     [exec]     at TLSSocket.socketErrorListener (node:_http_client:501:9)
     [exec]     at TLSSocket.emit (node:events:517:28)
     [exec]     at emitErrorNT (node:internal/streams/destroy:151:8)
     [exec]     at emitErrorCloseNT (node:internal/streams/destroy:116:3)
     [exec]     at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
     [exec]   errno: -104,
     [exec]   code: 'ECONNRESET',
     [exec]   syscall: 'read'
     [exec] }
     [exec] 
     [exec] Node.js v18.18.2
Error: Process completed with exit code 1.

@mbien mbien added the LSP [ci] enable Language Server Protocol tests label Nov 6, 2023
@lahodaj
Copy link
Contributor

lahodaj commented Nov 7, 2023

I restarted once more, and the job seems to pass now. I don't see how this patch could cause a failure like this.

@lahodaj
Copy link
Contributor

lahodaj commented Nov 15, 2023

I'll merge later tonight, unless there are objections.

@lahodaj lahodaj merged commit 3647f61 into apache:master Nov 15, 2023
@Achal1607 Achal1607 deleted the javavscode-23 branch November 20, 2023 05:28
@mbien mbien added this to the NB21 milestone Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do not merge Don't merge this PR, it is not ready or just demonstration purposes. Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) LSP [ci] enable Language Server Protocol tests VSCode Extension [ci] enable VSCode Extension tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants