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

Hope to add support for relative paths #2

Closed
cliuyang opened this issue Jan 9, 2021 · 11 comments
Closed

Hope to add support for relative paths #2

cliuyang opened this issue Jan 9, 2021 · 11 comments
Labels
enhancement New feature or request

Comments

@cliuyang
Copy link

cliuyang commented Jan 9, 2021

You may not imagine how EXCITED I am after seeing this project! I have been looking for a way to save the vscode layout.

I have been exploring the best practices for using vscode for algorithm competitions. You can see what I have done through this screenshot.

image

2021-01-10_00-56

My idea is to save this folder as a template and make a copy for use during the competition. But every time I open the folder with vscode, I have to re-layout. So vscode-save-editor-layout is exactly the extension I am looking for.

But now vscode-save-editor-layout only supports absolute paths. If I want to realize my idea, I must use relative paths. In fact, vscode-save-editor-layout works in a workspace where relative paths are more suitable than absolute paths. Therefore, can support for relative paths be increased?

In addition, can I specify a saved layout as the default layout and use it directly when opening the folder? This is very meaningful for a specific type of workspace.

I noticed that because of the lack of API, vscode-save-editor-layout can only support horizontal layout but not vertical layout, which is really a pity. :( But step by step, I think the function of saving the layout will be very useful. Thank you for your efforts.

I used Google Translate to translate from Chinese to English, so there may be some grammatical errors. Thanks again.

@ctf0
Copy link
Owner

ctf0 commented Jan 10, 2021

hi @cliuyang glad u liked the ext.

Therefore, can support for relative paths be increased?

can u tell how the path looks like & how to recreate one to test with ?

can I specify a saved layout as the default layout and use it directly when opening the folder?

this wont work as expected because it means that the ext will need to have some way of deciding what file will be saved in which group/column.

I used Google Translate to translate from Chinese to English, so there may be some grammatical errors. Thanks again.

no worries 👍

@ctf0 ctf0 added question Further information is requested enhancement New feature or request labels Jan 10, 2021
@cliuyang
Copy link
Author

hi @ctf0 this is what i mean

can u tell how the path looks like

Below is the path currently generated by vscode-save-editor-layout

settings

This path looks like/media/frankchen/Document/UbuntuOneDrive/storage-space/codeforces/C++ Algorithm Competition Template/src/A.cpp

My expected path is./src/A.cpp

how to recreate one to test with ?

Use the following steps to create a folder that is only used for testing. I will use pictures and shell codes to describe some ambiguous steps

  1. Create a new template folder and use vscode to open the template file, for example, use the following command

    mkdir template_folder
    code template_folder/

    template_folder_empty

  2. Create several cpp source files and input and output files
    template_folder_create_files

  3. Drag the editor to set the desired layout
    template_folder_layout

  4. Use vscode-save-editor-layout to save the layout and name italgorithm
    template_folder_save_group
    template_folder_rename_group
    template_folder_save_group_sucess

  5. Close vscode

  6. Copy the template folder and rename it, or use the following command

    cp -r test_folder Codeforces_Round
  7. Use vscode to open a new folder, or use the following command

    vscode Codeforces_Round
  8. Use vscode-save-editor-layout to open the previously set group
    codeforces_folder_open_group
    codeforces_folder_choose_group

  9. What I expect is that the layout of vscode will become like this after opening the group
    codeforces_folder_open_group_sucess
    But the current result of vscode-save-editor-layout is
    codeforces_folder_open_group_fail

this wont work as expected because it means that the ext will need to have some way of deciding what file will be saved in which group/column.

I think what I am looking forward to is that the steps 7 and 8 above are automatically carried out. In other words, I set a saved group as the default group, and then automatically use the group when opening this folder. Reflected in settings.json, it looks like this setting:

default

@ctf0
Copy link
Owner

ctf0 commented Jan 11, 2021

My expected path is./src/A.cpp

the reason we use full path is so u can open the file no matter the active workspace is, with relative path, it means we will have to resolve according to current workspace path.

8.Use vscode-save-editor-layout to open the previously set group

after u save the layout, open the ext view and hover on each file, u will find 4 navigation icons, which we use as a way around to force aligning the file to the rows/columns we want "this doesnt support nested groups though" check https://github.com/ctf0/vscode-save-editor-layout/blob/master/CHANGELOG.md#005

I set a saved group as the default group, and then automatically use the group when opening this folder

if i understand u correctly, u want to open folders in a default layout, if yes then i think it could be done in one of this options

  • have an option to toggle a saved group to either open its files in the layout or create an empty layout so u can add files later
    • to lay a folder files automatically on the opened group, this will need more work & it wont be as easy as we dont have an API to know where files are aligned.
  • have an option to save current layout without files "empty layout"

@ctf0
Copy link
Owner

ctf0 commented Jan 12, 2021

update

currently using the arrows doesnt produce the intended, not sure if something has changed in vscode or its a bug of mine, anyway will work on it later when i have time, hang in there.

@ctf0
Copy link
Owner

ctf0 commented Jan 12, 2021

for relative path i have an idea for it,
for default layout its under a new ticket #3

@ctf0 ctf0 removed the question Further information is requested label Jan 12, 2021
@ctf0 ctf0 changed the title Hope to add support for relative paths and default layout Hope to add support for relative paths Jan 12, 2021
@ctf0
Copy link
Owner

ctf0 commented Mar 12, 2021

@cliuyang can u check the latest release and tell me if it helps with ur issue ?

@cliuyang
Copy link
Author

@ctf0
It works better in saving and opening layouts, which makes me very happy. Thanks a lot. :)

But I did not understand the meaning of the Save To Global setting. It seems that it supports saving the layout in the workspace? But it still uses the full path, the difference is that the saved location is different.

I usually open a folder with vscode, this folder is my workspace. When I copy, move, and rename this folder, I hope that the saved layout can still be used.

As I said before, I often use vscode for algorithm competitions. My habit is to set up a template folder, copy it during the competition, and use it after renaming. I hope the Save Editor Layout can also be used in such occasions.

@ctf0
Copy link
Owner

ctf0 commented Mar 13, 2021

yeah yeah, the relative path option is not added yet, i was just testing if the latest changes made ur usage easier than b4 or not.

@cliuyang
Copy link
Author

Then I have to boast, the new version supports more complex layout settings, and the experience is very good.☺️

@ctf0
Copy link
Owner

ctf0 commented Mar 13, 2021

check latest release, relative path is now live.

@ctf0 ctf0 closed this as completed Mar 13, 2021
@cliuyang
Copy link
Author

Really cool job! Thanks a lot! lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants