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

cmd + click Create a file in the same level directory instead of the root directory. #994

Closed
faydanube opened this issue May 9, 2022 · 12 comments
Milestone

Comments

@faydanube
Copy link

Is your feature request related to a problem? Please describe.

cmd + click Create a file in the same level directory instead of the root directory

Describe the solution you'd like

cmd + click Create a file in the same level directory instead of the root directory

Describe alternatives you've considered

A path config like "${currentFolder}"

Screenshots or Videos

image

image

@riccardoferretti
Copy link
Collaborator

This issue is a bit more complicated as various people have different expectations regarding where the note should be created. We have been looking into a paradigm to reason about it in #683 but that effort has stalled atm

@faydanube
Copy link
Author

faydanube commented May 11, 2022

This issue is a bit more complicated as various people have different expectations regarding where the note should be created. We have been looking into a paradigm to reason about it in #683 but that effort has stalled atm

Is it difficult to add a configurable item? I will keep an eye on this issue, thanks very much.

@riccardoferretti
Copy link
Collaborator

My thinking at the moment is the following:

  • a configuration item with options to create the new file in the same directory or in the repo root
  • the item is overridden by a filepath property in the template, which must resolve to an absolute path to be used. If it doesn't resolve to an absolute path, it will ask the user to confirm the path of the item. A few variables are made available in the template to help with the resolution

Given the big amount of thinking and work @movermeyer put into spear heading this issue (in #683) and his "special interest" for templates in Foam, I wanted to include him in the resolution (although per the stalled PR I reckon he has been taken over by other things).

But thanks for bringing up the issue, I am sure several users are affected by this and would love some clear resolution rule with some level of flexibility.

@Lauviah0622
Copy link
Contributor

Lauviah0622 commented May 11, 2022

Currently, we can use [[directory/filename]] to create the file in directory but not root (I'm not sure it's been designed on purpose or coincidentally).

I use the following snippet to help me create the syntax which contain directory name.

{
    "New Foam Node": {
        "scope": "markdown",
        "prefix": "node",
        "body": [
	   "[[${RELATIVE_FILEPATH/(.*)\\..+/$1/}.$2.md]]$0"
        ],
        "description": "add new foam node"
        }
}

@faydanube
Copy link
Author

Currently, we can use [[directory/filename]] to create the file in directory but not root (I'm not sure it's been designed on purpose or coincidentally).

I use the following snippet to help me create the syntax which contain directory name.

{
    "New Foam Node": {
        "scope": "markdown",
        "prefix": "node",
        "body": [
	   "[[${RELATIVE_FILEPATH/(.*)\\..+/$1/}.$2.md]]$0"
        ],
        "description": "add new foam node"
        }
}

Keyboard Shortcuts do allow for this, but I'm mainly talking about cmd + click

image

@faydanube
Copy link
Author

My thinking at the moment is the following:

  • a configuration item with options to create the new file in the same directory or in the repo root
  • the item is overridden by a filepath property in the template, which must resolve to an absolute path to be used. If it doesn't resolve to an absolute path, it will ask the user to confirm the path of the item. A few variables are made available in the template to help with the resolution

Given the big amount of thinking and work @movermeyer put into spear heading this issue (in #683) and his "special interest" for templates in Foam, I wanted to include him in the resolution (although per the stalled PR I reckon he has been taken over by other things).

But thanks for bringing up the issue, I am sure several users are affected by this and would love some clear resolution rule with some level of flexibility.

Looking forward to problem solving, thanks for your reply.

@tv42
Copy link

tv42 commented Oct 26, 2022

This sounds like a duplicate of #864

@riccardoferretti riccardoferretti added this to the backlog milestone Nov 13, 2022
@xu4wang
Copy link

xu4wang commented Dec 22, 2022

I'm facing the same issue, as I put all my notes under project home/docs folder, and whenever I control+click to create a note, it will be created under project home. Which makes the handy control+click unusable for me.

Looking for a solution for this. Thanks..

@riccardoferretti
Copy link
Collaborator

This has been fixed in 0.20.6, with the introduction of foam.files.newNotePath

@faydanube
Copy link
Author

This has been fixed in 0.20.6, with the introduction of foam.files.newNotePath

Hi, it doesn't work. command + click Create a file in the root directory even if "foam.files.newNotePath": "currentDir"

Is your feature request related to a problem? Please describe.

cmd + click Create a file in the same level directory instead of the root directory

Describe the solution you'd like

cmd + click Create a file in the same level directory instead of the root directory

Describe alternatives you've considered

A path config like "${currentFolder}"

Screenshots or Videos

image image

@riccardoferretti
Copy link
Collaborator

Please open a new issue for the bug

@tv42
Copy link

tv42 commented Feb 23, 2023

Well, it doesn't work, and I did: #1170.

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

No branches or pull requests

5 participants