Skip to content

Add back removed ignore-last-opened functionality  #4487

Closed

Description

@jsjoeio

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

Activity

  1. added this to the 4.0.0 milestone on Nov 10, 2021
  2. 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 [/+] on Nov 10, 2021
  3. jsjoeio commented on Nov 16, 2021

    @jsjoeio
    ContributorAuthor

    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
  4. assigned and unassigned on Nov 16, 2021
  5. self-assigned this
    on Nov 19, 2021
  6. jsjoeio commented on Nov 22, 2021

    @jsjoeio
    ContributorAuthor

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

  7. code-asher commented on Nov 29, 2021

    @code-asher
    Member
  8. jsjoeio commented on Nov 29, 2021

    @jsjoeio
    ContributorAuthor

    Ahhh okay so we need to implement this still then.

  9. jsjoeio commented on Nov 29, 2021

    @jsjoeio
    ContributorAuthor

    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..."

  10. jsjoeio commented on Nov 30, 2021

    @jsjoeio
    ContributorAuthor

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions