Theia: [feature request] Opening a specific file from workspace via URL

Created on 19 Mar 2019  路  7Comments  路  Source: eclipse-theia/theia

Description

When using a flat file CMS, Hugo for instance, it is possible to embed an edit link into a page which returns a specific URL.
Then the user can click on that link to open the relevant file in the web IDE. This idea is sometimes called "deep-linking". It is very useful for users to be able to access a file within a file tree directly and is supported in a some web IDEs (codiad for instance).

Proposed function

Currently, it is possible to open a project in theia via specifiying the project URL, e.g.: https://theia.server.net/#/home/project/myproject
The proposal is to extend this function so that a file within a project can be opened on load or trigger the file to open in a new tab if a theia instance is already available.
Therefore, to open the file /testdir/testfile.md in the project, the user would link to the following URL: https://theia.server.net/#/home/project/myproject/testdir/testfile.md

OS and Theia version:

Linux Debian 9 (no-systemd), with Docker (kata-containers runtime) and image theiaide/theia-full:next

enhancement proposal workspace

Most helpful comment

I wonder could we then do it similarly how VS Code handles cli options: https://code.visualstudio.com/docs/editor/command-line#_opening-files-and-folders

We will need to use another delimiter, not a whitespace, for example ;.

i.e. #c:/myProject;package.json:5:10;c:/myProject2;tsconfig.json will create a new multi-root workspace with c:/myProject and c:/myProject2 as workspace roots and open package.json at line 5 and character 10 in first root and tsconfig.json from the second root.

We could reuse the same logic from cli.

All 7 comments

bump

https://theia.server.net/#/home/project/myproject/testdir/testfile.md

Which project will you expect to be opened? Or it just should be a file without a workspace?

I'm not sure how to go about such feature requests. Maybe we should discuss them on the dev meeting as well? We should decide whether it something which has to be within the scope of IDE framework or it is a feature which should be implemented by a concrete product. cc @svenefftinge @marcdumais-work ?

In our case we would like to open a file within the specific workspace.

So http://localhost:6789/theia/#/c:/Users/chakah/Workspace/toolbox/toolbox.theia-workspace opens the workspace configured in the theia-workspace file.

And http://localhost:6789/theia/#/c:/Users/chakah/Workspace/toolbox/toolbox.theia-workspace/testdir/testfile.md opens the same workspace and navigates to the testfile.

I agree, it would make sense to have workspace specified as well as the file to open within that workspace.

I wonder could we then do it similarly how VS Code handles cli options: https://code.visualstudio.com/docs/editor/command-line#_opening-files-and-folders

We will need to use another delimiter, not a whitespace, for example ;.

i.e. #c:/myProject;package.json:5:10;c:/myProject2;tsconfig.json will create a new multi-root workspace with c:/myProject and c:/myProject2 as workspace roots and open package.json at line 5 and character 10 in first root and tsconfig.json from the second root.

We could reuse the same logic from cli.

It would be important that this is also filesystem independent (I am running theia in a docker container over the web and it stores it's file tree from /home/project)

Was this page helpful?
0 / 5 - 0 ratings