Skip to content

Workspace name/folder as macro for log #5154

Closed

Description

@FMorschel

Is your feature request related to a problem? Please describe.
I received instructions to set the extension to save log files. E.g.:

"dart.flutterRunLogFile": "C:\\Dev\\Logs\\flutter_run.txt",
"dart.vmServiceLogFile": "C:\\Dev\\Logs\\vm_service.txt",
"dart.dapLogFile": "C:\\Dev\\Logs\\dap.txt",

When looking for these in VSCode settings, I found out about ${name} being supported inside the path as a macro for the debug session name.

However, I was also instructed to set these settings for each workspace so that different workspaces don't conflict with each other. Which is a little too verbose when having lots of projects that you'd like to log.

Describe the solution you'd like
I'd like for the extension to support ${folder} or ${workspace} or similar so that I can create a path like ~/dev/logs/${workspace}/${name}.

Describe alternatives you've considered
Manually creating an inner folder for each workspace and defining it to the workspace settings.

Additional context
I was also reminded that some workspaces in VSCode can be unnamed. So in this case I believe the files could be simply left under ~/dev/logs/${name} as for my example.

Activity

  1. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    on Jun 25, 2024
  2. added this to the v3.94.0 milestone on Jul 8, 2024
  3. DanTup commented on Jul 8, 2024

    @DanTup
    Member

    In the next version you can use ${workspaceName} and we'll insert the value from vscode.workspace.name (or if that's not set, "unnamed-workspace" - although I think that only happens if you have no folders open).

    The values VS Code gives us are:

    • The name (without the extension) of the current .code-workspace file (if there is one)
    • The name of the folder that's open (if not a workspace)
    • "untitled workspace" when you have multiple folders open but not saved as a workspace file

    Here's an example from my logs folder after opening a few projects (some of which are code-workspaces):

    image

  4. FMorschel commented on Jul 15, 2024

    @FMorschel
    ContributorAuthor

    Hi! Not sure if I'm doing something wrong, but I tested with:

    [...]\\logs\\${workspaceName}\\${name}\\file.txt
    

    And got:

    [...]\logs\entrega_sunsoft\${name}\file.txt
    

    Like, it didn't replace ${name} with anything.

    Separate

    Also, here are all the files I'm setting:

    image

    Although some of the markdown hints you changed it so it would show that ${workspaceName} would work, only flutterTestLogFile does show that we can also use ${name}:

    image

    And the extensionLogFile shows neither.

    image

    I would be willing to fix these markdowns with a PR but again, I'm not sure I could fix the ${name} since I'm not even sure what it would show in my case. My guess is that this would show, but maybe I don't get it:

    image

  5. FMorschel commented on Jul 16, 2024

    @FMorschel
    ContributorAuthor

    I saw you created #5184 relating to the first part of my last comment here. I created #5185 to fix the descriptions I also mentioned above.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions