bxantus / mdoc

Markdown documentation viewer for Visual Studio Code
MIT License
5 stars 0 forks source link

Save relative paths in `.vscode` #6

Open thany opened 3 years ago

thany commented 3 years ago

The configuration seems to be saved in C:\Users\<username>\.mdoc. Several problems with this:

  1. This is an incorrect place to store user configuration on Windows. User configuration should go in <user dir>\AppData\Roaming\<application>\. That way it'll get synced for roaming profiles, and it sits in the right spot for various other purposes. Many software does this incorrectly, but that's no excuse of course.
  2. But other than that, I feel it's much more useful to store this in file with the project that's being worked on. This extension is super useful to display documentation of a project that's also being developed on, but in order to easily share mdoc configuration, it's important to be able to commit its configuration to source control, so everyone has the same file. The todo extension does this as well, as an example.
  3. And because of (2), it's also important that the directories residing in the projects.json be relative to the project where the configuration is stored in.

So I imagine this projects configuration be stored in a .vscode directory, where project-specific VScode settings are supposed to go. Then, the project root dir is known, and directories can be made relative to the project root dir. So the projects.json, being stored in .vscode/mdoc/projects.json could look something like this:

{
    "projects": [
        {
            "uri": "./Documentation"
        }
    ]
}

I don't currently see a way to get mdoc to look there for the projects.json, let alone resolve relative paths.

(On a sidenote, my projects.json has 4 entries, 3 are identical and 1 is not correct. I'm only seeing one documentation root... Bug? Should this file automatically clean itself up or what?)

(On a secondary side, maybe not call this file projects.json - this is confusing because a project is a directory of source stuff that is opened in VScode. A project is not a collection of documentation. Rather call it documentation.json or something)

bxantus commented 3 years ago

Just a quick explanation, why currently the extension works like this:

Your suggestion makes sense, just I did not have the time to implement this alternative configuration storage.

Probably we should let the users choose if they would like to configure the documentation projects locally in the workspace or globally. Also some kind of migration should be provided for the other users. I'm still not sure that the settings would be a good place for this, but probably we could use .vscode/documentations.json or something similar... (You're right project may be misleading, but I thought it is fine if placed under the .mdoc directory. documentation is ageneric name as well, Maybe we should name it as mdoc.json?)

thany commented 3 years ago

mdoc.json would probably be the best name. As for migration, I don't know if that's neccesary, as long as the extension can work with any of the current & proposed locations for config.