Skip to content

Add back removed ignore-last-opened functionality #4487

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

Closed
jsjoeio opened this issue Nov 10, 2021 · 6 comments
Closed

Add back removed ignore-last-opened functionality #4487

jsjoeio opened this issue Nov 10, 2021 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@jsjoeio
Copy link
Contributor

jsjoeio commented Nov 10, 2021

Add back removed ignore-last-opened functionality (actually the last opened functionality is missing entirely)

@jsjoeio jsjoeio added the bug Something isn't working label Nov 10, 2021
@jsjoeio jsjoeio added this to the 4.0.0 milestone Nov 10, 2021
@jsjoeio jsjoeio changed the title Add back removed ignore-last-opened functionality (actually the last opened functionality is missing entirely) Add back removed ignore-last-opened functionality Nov 10, 2021
@jsjoeio
Copy link
Contributor Author

jsjoeio commented Nov 16, 2021

Raw Notes

Get the last opened directory (folder or workspace).

  • check query variables
  • look at settings.json

This is where it used to be: https://github.com/cdr/code-server/blob/v3.12.0/src/node/vscode.ts#L39-L56

We could write to vscode settings. How do we do that? Maybe the `sett

This is how you get the Settings (StorageService)
image

If query variables are set, use those instead. Write that to settings.

  1. get workspace from query variables, CLI, or settings
  2. write result to VS Code Settinsg

Priority

  1. query variables
  2. if ew query, then we set it to undefined (I guess it means closed)
  3. CLI (this exists)
  4. whatever you last opened. comes from VS Code settings (we need to add this)

Implementation

  1. add a method for _getWorkspaceFromQueryVariables()
  2. add a method for _getWorkspaceFromSettings()

Testing

  • manually test
  • e2e test
  • see if they test _getWorkspaceFromCLI

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Nov 22, 2021

We believe this has been fixed via coder/vscode#18 but assigning to @code-asher to confirm and close.

@jsjoeio jsjoeio assigned code-asher and unassigned GirlBossRush Nov 22, 2021
@code-asher
Copy link
Member

code-asher commented Nov 29, 2021 via email

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Nov 29, 2021

Ahhh okay so we need to implement this still then.

@jsjoeio jsjoeio assigned jsjoeio and unassigned code-asher Nov 29, 2021
@jsjoeio
Copy link
Contributor Author

jsjoeio commented Nov 29, 2021

We think this may be in main. I will test then close if true.

If you pass that flag, it should open a blank editor (even if you open a new folder - without the folder param, it should be blank).

If you pass that flag as well as give a default directory on the command line, instead of blank, it should always open that workspace.

# should open previously opened
code-server
# should always open blank
code-server --ignore-last-opened
# should always open the default directory
code-server --ignore-last-opened .
code-server # should always open last opened
code-server --ignore-last-opened # should always show blank/no workspace (purple bar)
code-server --ignore-last-opened . # should always open current directory
  1. run code-server
  2. go to localhost:8080
  3. open some directory like /tmp
  4. go to localhost:8080 again (remove ?folder param if any)

"Economists hate this one trick..."

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Nov 30, 2021

I tested the above cases and here is what the results where.

✅ Running code-server should open previously opened directory

This works as expected. Steps to reproduce:

  1. run yarn watch to start code-server locally
  2. open localhost:8080 in browser
  3. open a directory: cs-test
  4. close tab
  5. repeat step 2
  6. see new directory cs-test opened in new tab

image

✅ Running code-server --ignore-last-opened should show blank every time

  1. run yarn watch --ignore-last-opened to start code-server locally
  2. open localhost:8080 in browser
  3. open a directory: cs-test
  4. close tab
  5. repeat step 2
  6. see blank workspace (no directory)

image

✅ Running code-server --ignore-last-opened . should always open current directory

  1. run yarn watch --ignore-last-opened . to start code-server locally
  2. open localhost:8080 in browser
  3. open a directory: cs-test
  4. close tab
  5. repeat step 2
  6. see the directory at . (in my case code-server)

image

Awesome work by @TeffenEllis! 🎉

This has indeed been fixed by coder/vscode#18

@jsjoeio jsjoeio closed this as completed Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants