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

Support snippets for VS Code extensions running in a Che Theia sidecar #16502

Closed
2 tasks done
sunix opened this issue Mar 31, 2020 · 22 comments
Closed
2 tasks done

Support snippets for VS Code extensions running in a Che Theia sidecar #16502

sunix opened this issue Mar 31, 2020 · 22 comments
Assignees
Labels
area/languages Issues related to Language extensions or plugins integration. kind/bug Outline of a bug - must adhere to the bug report template. new&noteworthy For new and/or noteworthy issues that deserve a blog post, new docs, or emphasis in release notes severity/P1 Has a major impact to usage or development of the system.
Milestone

Comments

@sunix
Copy link
Contributor

sunix commented Mar 31, 2020

Describe the bug

In Java files, the code snippet (to generate try catch block) try_catch is not working

Che version

  • latest

Steps to reproduce

  1. Start a Java workspace with a Java project (any of the getting started)
  2. Open a Java file
  3. type try and Ctrl+space inside a method

Expected behavior

Expected to have the try_catch like in VSCode:
Selection_694

But had no try_catch code snippet :(
Selection_695

Runtime

  • Openshift 4.3 and che.openshift.io
@sunix sunix added kind/bug Outline of a bug - must adhere to the bug report template. area/languages Issues related to Language extensions or plugins integration. labels Mar 31, 2020
@che-bot che-bot added the status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. label Mar 31, 2020
@skabashnyuk skabashnyuk added severity/P1 Has a major impact to usage or development of the system. and removed status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. labels Mar 31, 2020
@tsmaeder
Copy link
Contributor

tsmaeder commented Apr 1, 2020

FWIW, this works in Theia master with the latest built-ins.

@skabashnyuk skabashnyuk added severity/P2 Has a minor but important impact to the usage or development of the system. and removed severity/P1 Has a major impact to usage or development of the system. labels Apr 1, 2020
@skabashnyuk
Copy link
Contributor

FWIW, this works in Theia master with the latest built-ins.

@sunix can you test?

@sunix
Copy link
Contributor Author

sunix commented Apr 1, 2020

FWIW, this works in Theia master with the latest built-ins.

is Theia using the Red Hat Java vscode ext ?

@sunix
Copy link
Contributor Author

sunix commented Apr 1, 2020

@sunix can you test?

No I don't have Theia installed locally. I let the assignee test with Theia if it is needed.

@IveJ
Copy link

IveJ commented Apr 1, 2020 via email

@sunix
Copy link
Contributor Author

sunix commented Apr 25, 2020

Sorry guys but it is impossible to code without a minimum of snippet ... main snippet is not working neither ....

@sunix sunix changed the title in Java, the code snippet try_catch is not working in Java, the code snippet try_catch, main and maybe more are not working Apr 25, 2020
@sunix sunix added severity/P1 Has a major impact to usage or development of the system. and removed severity/P2 Has a minor but important impact to the usage or development of the system. labels Apr 25, 2020
@sunix sunix changed the title in Java, the code snippet try_catch, main and maybe more are not working in Java, the code snippets try_catch, main and maybe more are not working Apr 26, 2020
@phaumer
Copy link

phaumer commented May 28, 2020

I can confirm this bug as well.

Code snippets that were defined via the VSIX package.json contributes.snippets array appear in Theia, but not Eclipse Che. For example the Red Hat Java VSIX defines two set of snippets.

  • One that is just listed in package.json does not work.
  • The other set that gets loaded via a VS Code CompletionItemProvider implementation does appear.

Theia 1.0.0/1.2.0:
image

Che 7.13.1
image

@ericwill ericwill mentioned this issue Jul 15, 2020
38 tasks
@ericwill ericwill added this to the 7.17 milestone Jul 15, 2020
@tsmaeder
Copy link
Contributor

Confirmed with vscode-java 0.62 in theia and vscode-java 0.63 in openshift.io.

@tsmaeder
Copy link
Contributor

The problem is that the package.json in vscode-java contributes snippets with a relative uri like so:

    "snippets": [
      {
        "language": "java",
        "path": "./snippets/java.json"
      }
    ],

The code in TheiaPluginScanner#readSnippets() constructs an URI from this like so:

uri: FileUri.create(path.join(pck.packagePath, contribution.path)).toString()

This file uri is supposed to refert to a location relative to where package.json of the vscode extension is located. This works fine when the package is installed in the same place as the Theia back end, but fails when the package is located in a sidecar container.

@tsmaeder
Copy link
Contributor

There are two ways we could fix this:

  1. Leave the URI as it is, but bring the files to the container where they are expected (where the Theia back end is running)
  2. Fix the generation of the URI: we already have a way of resolving sidecar-relative URI's.

My first aproach will be to fix the URI

@ArvinB
Copy link

ArvinB commented Jul 16, 2020

@tsmaeder I like your approach to fix the URI. Will you make this fix and how soon? We can assist by verifying.

@tsmaeder tsmaeder self-assigned this Jul 17, 2020
@tsmaeder
Copy link
Contributor

I'm working on it.

@tsmaeder
Copy link
Contributor

Turns out the monaco-snippet-suggest-provider.ts uses the FileSystem class directly, not a Resource. Since our workaround is based on resource, it does not get applied. I guess the right thing to do would be to implement file system providers for plugin resources after https://github.com/eclipse-theia/theia/pull/7908/files is merged

@fbricon
Copy link

fbricon commented Jul 20, 2020

the snippets defined in package.json are only used until the Language Server has started. After that, they're disabled and server-side snippets should take over. See redhat-developer/vscode-java#1101

@tsmaeder
Copy link
Contributor

tsmaeder commented Jul 20, 2020

@fbricon that may be, but the file referenced in package.json still isn't resolved properly. So are you saying the "try" snippet should work eventually? Because I'm not seeing that happening in che-theia.

@ArvinB
Copy link

ArvinB commented Aug 20, 2020

@benoitf We can test and do that. Thank you.

@nickboldt
Copy link
Contributor

doot doot doo... moving stuff to a more reasonable milestone... doot doot doo... paperwork makes the project better...

@nickboldt nickboldt modified the milestones: 7.23, 7.25 Jan 8, 2021
@ericwill ericwill mentioned this issue Jan 14, 2021
33 tasks
@ericwill ericwill modified the milestones: 7.25, 7.26 Jan 20, 2021
@ericwill ericwill mentioned this issue Feb 4, 2021
35 tasks
@ericwill ericwill modified the milestones: 7.26, 7.27 Feb 8, 2021
@ericwill ericwill mentioned this issue Feb 25, 2021
46 tasks
@ericwill ericwill modified the milestones: 7.27, 7.28 Mar 2, 2021
@l0rd l0rd added the new&noteworthy For new and/or noteworthy issues that deserve a blog post, new docs, or emphasis in release notes label Apr 19, 2021
@l0rd l0rd changed the title Java code snippets 'try_catch' and 'main' are not working Support snippets for VS Code extensions running in a Che Theia sidecar Apr 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/languages Issues related to Language extensions or plugins integration. kind/bug Outline of a bug - must adhere to the bug report template. new&noteworthy For new and/or noteworthy issues that deserve a blog post, new docs, or emphasis in release notes severity/P1 Has a major impact to usage or development of the system.
Projects
None yet
Development

No branches or pull requests