pajoma / vscode-journal

Lightweight journal and simple notes support for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=pajoma.vscode-journal
GNU General Public License v3.0
233 stars 40 forks source link

Feature request: Base setting to allow path relative to workspace #66

Closed flowt-au closed 3 years ago

flowt-au commented 3 years ago

Thanks. Loving this extension.

I keep my journal folders in my workspaces and have the workspaces synced on different machines, with different absolute paths to those workspaces.

It would be great to be able to set the base to (say) ./journal rather than needing to specify the absolute path.

Thanks!

pajoma commented 3 years ago

You have two options:

If you have different paths outside of your home directory, I don't see any option to specify relative paths (relative to what?)

flowt-au commented 3 years ago

Thanks for that.

I don't see any option to specify relative paths (relative to what?)

I have a different set of journals for each workspace and a ./journal folder in each workspace. So it would be relative to the workspace root and (as long as a / path separator worked on both platforms) would work on all platforms.

:-)

pajoma commented 3 years ago

Ok, I understand. So your problem could be solved by supporting the variable "${workspaceRoot}" in the settings, and you would always use ${workspaceRoot}/journal?

Just checking, because that's what the source is already doing (but neither documented nor tested ;)

flowt-au commented 3 years ago

Not quite. Perhaps an example will help me explain. The same project is located as follows:

On my Mac: "journal.base": "/www/workshopPrograms/journal", On my PC: "journal.base": "c:\\server\\wwwroot\\Sites\\workshopPrograms\\journal",

and my VsCode workshopPrograms.code-workspace is in the workshopPrograms folder in both cases.

So, if I could just specify: "journal.base": "./journal", ie relative to the workspace folder workshopPrograms then it could work on both machines without modification.

Thanks again, Murray

flowt-au commented 3 years ago

PS: Just to reiterate, your extension is so useful! I can keep all my notes and links in the one place and in conjunction with ToDo Tree extension I have a cross reference to "Ideas" "ToDos" etc. I dont use the date logging at all, just the collection of notes about the project by leveraging the "vscode-journal-view.showNonJournalFiles": true, setting.

Thank you.

pajoma commented 3 years ago

Taking your example, you would have in both your workspaces directories

/www/workshopPrograms/journal/.vscode/ c:\\server\\wwwroot\\Sites\\workshopPrograms\\journa\\.vscode\

the same synchronized settings.json with the entry

{
  "journal.base": "${workspaceRoot}/journal",
}

The problem is: The extension can't resolve to full paths (which vscode needs) when it can't infer what the "." refers to. You could add "./journal" into your user settings, but then the extension fails when you have no workspace open.

Thanks for the tip on the ToDo Tree, looks pretty useful.

flowt-au commented 3 years ago

Yes, I imagine that would work if supported. At present it does not work. See screenshots:

With the full path specified it finds the md files: Greenshot 2020-12-04 10 36 03

With "${workspaceRoot}/journal" it does not. Greenshot 2020-12-04 10 36 58

I tried with and with slashes etc, but couldn't find a way for it to work.

It isn't urgent or a deal-breaker, just a nice-to-have enhancement. Cheers, Murray

inactivist commented 3 years ago

Confirming "journal.base": "${workspaceRoot}/journal"} works as expected, after restarting VSCode. If I don't restart, the default (or prior) setting seems to remain in effect.

extension version 0.11.2 vscode version 1.52.1 Linux

Version: 1.52.1
Commit: ea3859d4ba2f3e577a159bc91e3074c5d85c0523
Date: 2020-12-16T16:32:10.090Z
Electron: 9.3.5
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Linux x64 4.15.0-134-generic
moocan commented 3 years ago

Hello,

Thank you for your great extension.

I'm keeping too my notes inside my workspaces folder. Each workspace has a .note folder, so all associated notes remain with each project.

I have tested with ${workspaceFolder}/.note as journal.base. VisualStudio Code variable ${workspaceFolder} is the full path to the project root folder eg /DATA/Projects/MyProject-1 and ${workspaceRoot} is only MyProject-1 and vscode-journal created notes in /home/myuser/${workspaceFolder}/.note after creating ${workspaceFolder} and using ${workspaceFolder} as a true folder name inside my home folder but not in /DATA/Projects/MyProject-1/.note

Regards

pajoma commented 3 years ago

I have tested with ${workspaceFolder}/.note as journal.base. VisualStudio Code variable ${workspaceFolder} is the full path to the project root folder eg /DATA/Projects/MyProject-1 and ${workspaceRoot} is only MyProject-1 and vscode-journal created notes in /home/myuser/${workspaceFolder}/.note after creating ${workspaceFolder} and using ${workspaceFolder} as a true folder name inside my home folder but not in /DATA/Projects/MyProject-1/.note

Did you use ${workspaceFolder} or ${workspaceRoot} in yout settings?

moocan commented 3 years ago

@pajoma

Hello, I tried with ${workspaceFolder} in journal.base. vscode-journalnever tried to access/DATA/Projects/MyProject-1 which is the value of ${workspaceFolder} variable when VS Code is opening this project folder or tried to resolved the variable value but created a '${workspaceFolder}' using ${workspaceFolder} (the variable name) as the folder name in my home directory as /home/myuser/${workspaceFolder}.

Regards

pajoma commented 3 years ago

vscode-journalnever tried to access/DATA/Projects/MyProject-1 which is the value of ${workspaceFolder} variable when VS Code is opening this project folder or tried to resolved the variable value but created a '${workspaceFolder}' using ${workspaceFolder} (the variable name) as the folder name in my home directory as /home/myuser/${workspaceFolder}.

${workspaceFolder} was not supported until now, it was ${workspaceRoot} in the past (see deprecation message here: https://code.visualstudio.com/docs/editor/variables-reference#_why-isnt-workspaceroot-documented). The extension now supports both.