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

Theia can't open files located in a sidecar container #13614

Closed
tolusha opened this issue Jun 21, 2019 · 13 comments
Closed

Theia can't open files located in a sidecar container #13614

tolusha opened this issue Jun 21, 2019 · 13 comments
Assignees
Labels
kind/bug Outline of a bug - must adhere to the bug report template.
Milestone

Comments

@tolusha
Copy link
Contributor

tolusha commented Jun 21, 2019

Description

Reproduction Steps

  1. Start workspace with a Typescrip plugin.
  2. Goto preferences and set typescript.tsserver.trace to verbose
  3. Try to run command Open TS server log file
  4. Server log file can't be opened

OS and version:
Che-7.0.0-CR2

Diagnostics:
LS sends request to Theia to open a log file but Theia can't find the file because it is located in a side-car container.

#13428

@tolusha tolusha added the kind/bug Outline of a bug - must adhere to the bug report template. label Jun 21, 2019
@tolusha
Copy link
Contributor Author

tolusha commented Aug 6, 2019

It is turned out to be a more general issue when plugin sends request to Theia to open an file that exists only in a sidecar container.

errors.ts:81 Uncaught Error: 'file:///usr/include/c%2B%2B/8/iostream' has not been found.

Error: Request 'resolveContent' failed
    at Proxy.<anonymous> (https://static.developers.redhat.com/che/theia_artifacts/theia.80ec0f4ae0530039ebdd.js:1:1742008)
    at e.<anonymous> (https://static.developers.redhat.com/che/theia_artifacts/theia.80ec0f4ae0530039ebdd.js:1:1918534)
    at https://static.developers.redhat.com/che/theia_artifacts/theia.80ec0f4ae0530039ebdd.js:1:1917105
    at Object.next (https://static.developers.redhat.com/che/theia_artifacts/theia.80ec0f4ae0530039ebdd.js:1:1917210)
    at https://static.developers.redhat.com/che/theia_artifacts/theia.80ec0f4ae0530039ebdd.js:1:1916123
    at new Promise (<anonymous>)
    at T1Xs.a (https://static.developers.redhat.com/che/theia_artifacts/theia.80ec0f4ae0530039ebdd.js:1:1915900)
    at e.readContents (https://static.developers.redhat.com/che/theia_artifacts/theia.80ec0f4ae0530039ebdd.js:1:1918393)
    at new e (https://static.developers.redhat.com/che/theia_artifacts/theia.80ec0f4ae0530039ebdd.js:1:4146586)
    at e.<anonymous> (https://static.developers.redhat.com/che/theia_artifacts/theia.80ec0f4ae0530039ebdd.js:1:1456739)
Caused by: Error: 'file:///usr/include/c%2B%2B/8/iostream' has not been found.
    at FileSystemNode.<anonymous> (/home/theia/node_modules/@theia/filesystem/lib/node/node-filesystem.js:160:64)
    at step (/home/theia/node_modules/@theia/filesystem/lib/node/node-filesystem.js:59:23)
    at Object.next (/home/theia/node_modules/@theia/filesystem/lib/node/node-filesystem.js:40:53)
    at fulfilled (/home/theia/node_modules/@theia/filesystem/lib/node/node-filesystem.js:31:58)
    at https://cdn.jsdelivr.net/npm/@typefox/monaco-editor-core@0.14.6/min/vs/editor/editor.main.js:158:350

@tolusha tolusha changed the title Typescript command: Open TS server log file doesn't work Theia can't open files located in a sidecar container Aug 6, 2019
@slemeur slemeur mentioned this issue Aug 6, 2019
20 tasks
This was referenced Aug 8, 2019
@tolusha
Copy link
Contributor Author

tolusha commented Aug 14, 2019

It is relatively easy to redirect a request to retrieve content from a side-car container, but we have to take into account that redirection matters only for files that are not available from a Theia container.

@tsmaeder
Copy link
Contributor

An approach would be to rewrite some URIs (those not under /projects) when we get them from plugins and redispatch them to the plugin containers for resolving contents, etc. We should start a conversation about this on che-dev and do a spike first.

@tolusha
Copy link
Contributor Author

tolusha commented Aug 27, 2019

@tsmaeder
Copy link
Contributor

@tolusha but if I understand correctly, the file being opened is, for example as a result of a "goto definition" request, which is not going through "open document".
I think the approach should be to change all api calls that return URI's to return an uri that is specific to the sidecar (unless it's a uri that is in a known shared area)

@tolusha
Copy link
Contributor Author

tolusha commented Aug 28, 2019

It probably will require to override some other API calls but I don't know for sure which ones.

@tsmaeder
Copy link
Contributor

tsmaeder commented Aug 28, 2019

@tolusha all of them which return a URI. But for a PoC, we could start with the case that fails with the CPP extension

@tsmaeder tsmaeder mentioned this issue Aug 29, 2019
41 tasks
@tolusha
Copy link
Contributor Author

tolusha commented Aug 30, 2019

@tolusha tolusha self-assigned this Sep 2, 2019
@tolusha
Copy link
Contributor Author

tolusha commented Sep 3, 2019

We still have issue with gotoDefinition for c/c++ plugin

root INFO {exception: null, error: Error: Request 'resolveContent' failed
    at Proxy.<anonymous> (http://routejunfjjtr-che.192.168.9…, promise: n.C…s.d…e._creator, handler: undefined, id: 6, …}error: Error: Request 'resolveContent' failed
    at Proxy.<anonymous> (http://routejunfjjtr-che.192.168.99.100.nip.io/bundle.js:12:923880)
    at e.<anonymous> (http://routejunfjjtr-che.192.168.99.100.nip.io/bundle.js:30:150903)
    at http://routejunfjjtr-che.192.168.99.100.nip.io/bundle.js:30:149492
    at Object.next (http://routejunfjjtr-che.192.168.99.100.nip.io/bundle.js:30:149597)
    at http://routejunfjjtr-che.192.168.99.100.nip.io/bundle.js:30:148510
    at new Promise (<anonymous>)
    at a (http://routejunfjjtr-che.192.168.99.100.nip.io/bundle.js:30:148287)
    at e.readContents (http://routejunfjjtr-che.192.168.99.100.nip.io/bundle.js:30:150762)
    at new e (http://routejunfjjtr-che.192.168.99.100.nip.io/bundle.js:30:473498)
    at e.<anonymous> (http://routejunfjjtr-che.192.168.99.100.nip.io/bundle.js:12:768245)
Caused by: Error: 'file:///usr/include/c%2B%2B/8/iostream' has not been found.
    at FileSystemNode.<anonymous> (/home/theia/node_modules/@theia/filesystem/lib/node/node-filesystem.js:162:64)
    at step (/home/theia/node_modules/@theia/filesystem/lib/node/node-filesystem.js:59:23)
    at Object.next (/home/theia/node_modules/@theia/filesystem/lib/node/node-filesystem.js:40:53)
    at fulfilled (/home/theia/node_modules/@theia/filesystem/lib/node/node-filesystem.js:31:58)exception: nullhandler: undefinedid: 6parent: undefinedpromise: n.Class.derive._creator {_creator: null, _nextState: null, _state: {…}, _value: Error: Request 'resolveContent' failed
    at Proxy.<anonymous> (http://routejunfjjtr-che.192.168.9…, _listeners: null, …}__proto__: Object
editor.main.js:158 Uncaught Error: 'file:///usr/include/c%2B%2B/8/iostream' has not been found.

Error: Request 'resolveContent' failed
    at Proxy.<anonymous> (http://routejunfjjtr-che.192.168.99.100.nip.io/bundle.js:12:923880)
    at e.<anonymous> (http://routejunfjjtr-che.192.168.99.100.nip.io/bundle.js:30:150903)
    at http://routejunfjjtr-che.192.168.99.100.nip.io/bundle.js:30:149492
    at Object.next (http://routejunfjjtr-che.192.168.99.100.nip.io/bundle.js:30:149597)
    at http://routejunfjjtr-che.192.168.99.100.nip.io/bundle.js:30:148510
    at new Promise (<anonymous>)
    at a (http://routejunfjjtr-che.192.168.99.100.nip.io/bundle.js:30:148287)
    at e.readContents (http://routejunfjjtr-che.192.168.99.100.nip.io/bundle.js:30:150762)
    at new e (http://routejunfjjtr-che.192.168.99.100.nip.io/bundle.js:30:473498)
    at e.<anonymous> (http://routejunfjjtr-che.192.168.99.100.nip.io/bundle.js:12:768245)
Caused by: Error: 'file:///usr/include/c%2B%2B/8/iostream' has not been found.
    at FileSystemNode.<anonymous> (/home/theia/node_modules/@theia/filesystem/lib/node/node-filesystem.js:162:64)
    at step (/home/theia/node_modules/@theia/filesystem/lib/node/node-filesystem.js:59:23)
    at Object.next (/home/theia/node_modules/@theia/filesystem/lib/node/node-filesystem.js:40:53)
    at fulfilled (/home/theia/node_modules/@theia/filesystem/lib/node/node-filesystem.js:31:58)
    at http://routejunfjjtr-che.192.168.99.100.nip.io/vs/editor/editor.main.js:158:350

@tsmaeder
Copy link
Contributor

tsmaeder commented Sep 3, 2019

@tolusha yes, we need to override all requests that return an uri from a sidecar, like "references", "definitions", etc, etc. We will not be able to catch them all (for example, if uri's are inside command parameters, which are unknown to us), but most of them.

@tsmaeder
Copy link
Contributor

tsmaeder commented Sep 4, 2019

I think handling uri's in the languages namespace would go a long way: https://code.visualstudio.com/api/references/vscode-api#languages

@tsmaeder
Copy link
Contributor

tsmaeder commented Sep 4, 2019

We'll start by fixing the issue with the C++ plugin and provide a PR for that (definitions provider).

@tolusha
Copy link
Contributor Author

tolusha commented Sep 18, 2019

I've added overriding definition provider [1] and it allowed gotoDefinition feature works. The work isn't completed. Navigation in that file (iostream) doesn't work.

[1] https://github.com/eclipse/che-theia/blob/ab/scc/extensions/eclipse-che-theia-plugin-remote/src/node/languages-container-aware.ts#L22

Screenshot from 2019-09-18 13-51-04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Outline of a bug - must adhere to the bug report template.
Projects
None yet
Development

No branches or pull requests

2 participants