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

Enable uri schemes #15

Merged
merged 5 commits into from
Aug 17, 2021
Merged

Enable uri schemes #15

merged 5 commits into from
Aug 17, 2021

Conversation

rwols
Copy link
Member

@rwols rwols commented Jun 20, 2021

This attaches jdtls to views with a jdt: URI scheme. Depends on sublimelsp/LSP#1758

@rwols
Copy link
Member Author

rwols commented Jul 4, 2021

... and 1ccb871 defines on_open_uri_async to handle jdt: with the custom java/classFileContents request.

@rwols
Copy link
Member Author

rwols commented Jul 4, 2021

Not sure if it actually works. Just went ahead with this given the code in LSP-Deno. Someone with access to a debugger would have to verify this working.

@rwols rwols requested a review from LDAP July 4, 2021 09:32
@LDAP
Copy link
Collaborator

LDAP commented Jul 4, 2021

Something does not work as expected (have a look at the path):
grafik

This seems like a Debugger issue.
Maybe @daveleroy can help with this as the path looks good in the Debugger protocol:

⟹ response/stackTrace(22) :: {'stackFrames': [{'id': 3, 'source': {'name': 'Thread.java', 'path': 'jdt://contents/java.base/java.lang/Thread.class?=jdt.ls-java-project/D:%5C/Local_Repositories%5C/windows-dev-tools%5C/bins%5C/jdk%5C/lib%5C/jrt-fs.jar%60java.base=/javadoc_location=/https:%5C/%5C/docs.oracle.com%5C/en%5C/java%5C/javase%5C/15%5C/docs%5C/api%5C/=/%3Cjava.lang(Thread.class', 'sourceReference': 0}, 'line': 841, 'column': 1, 'name': 'Thread.exit()'}], 'totalFrames': 1}

@rwols
Copy link
Member Author

rwols commented Jul 4, 2021

I guess if you only have an URI in the debugger, you can't actually open it via the session.open_location_async machinery. We would need a window command for that.

@rwols
Copy link
Member Author

rwols commented Aug 17, 2021

Given a path in the stackTrace response:

'path': 'jdt://contents/java.base/java.lang/Thread.class?=jdt.ls-java-project/D:%5C/Local_Repositories%5C/windows-dev-tools%5C/bins%5C/jdk%5C/lib%5C/jrt-fs.jar%60java.base=/javadoc_location=/https:%5C/%5C/docs.oracle.com%5C/en%5C/java%5C/javase%5C/15%5C/docs%5C/api%5C/=/%3Cjava.lang(Thread.class'

you then need to invoke the ST view command

lsp_open_location

with arguments

{
    "location":
    {
        "uri": "jdt://contents/...",
        "range":
        {
            "start":
            {
                "line": 841,  // not sure if DAP is 1-based or 0-based; LSP is 0-based.
                "character": 1 // not sure if DAP is 1-based or 0-based; LSP is 0-based.
            },
            "end":
            {
                "line": 841, // not sure if DAP is 1-based or 0-based; LSP is 0-based.
                "character": 1 // not sure if DAP is 1-based or 0-based; LSP is 0-based.
            }
        }
    },
    "session_name": "jdtls"
}

This invocation should be done from within the DAP package.

@rwols rwols merged commit 99c8066 into main Aug 17, 2021
@rwols rwols deleted the feat/uri-schemes branch August 17, 2021 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants