eclipse-theia / theia

Eclipse Theia is a cloud & desktop IDE framework implemented in TypeScript.
http://theia-ide.org
Eclipse Public License 2.0
19.86k stars 2.48k forks source link

[feature request] Opening a specific file from workspace via URL #4604

Open zeigerpuppy opened 5 years ago

zeigerpuppy commented 5 years ago

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

Chakah commented 5 years ago

bump

akosyakov commented 5 years ago

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?

akosyakov commented 5 years ago

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 ?

Chakah commented 5 years ago

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.

zeigerpuppy commented 5 years ago

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

akosyakov commented 5 years ago

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.

zeigerpuppy commented 4 years ago

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)

HardikArora505 commented 1 year ago

is this implemented yet?