natecraddock / workspaces.nvim

a simple plugin to manage workspace directories in neovim
MIT License
309 stars 15 forks source link

[Question] Usage of type field in the obtained list of workspaces #24

Closed HuM4NoiD closed 1 year ago

HuM4NoiD commented 1 year ago

I did not find the discussions tab, so I apologize for raising an issue

I noticed a type field along with other relevant information in a single item from the table returned by require("workspaces").get():

{                                                                                                                                                
    last_opened = "2023-08-18T09:56:56",
    name = "project",
    path = "/home/user/code/project/",
    type = ""
}

I wanted to know if this type field was being used by workspaces. If it wasn't, I'd want to:

natecraddock commented 1 year ago

I did not find the discussions tab, so I apologize for raising an issue

This project is small enough that I think issues work fine, no worries!

The type field is used for the directory of workspaces support used by the WorkspacesAddDir command and other commands.

In the current code you could safely store a string in that field, so long as that string is not 'directory' and everything should work fine from what I can see. But there is no guarantee that things would work in the future.

HuM4NoiD commented 1 year ago

How do I set that field and make sure it persists? is there a command? or a function that takes in the table structure mentioned in the op?

natecraddock commented 1 year ago

Thanks for bringing that up, I guess I didn't think hard enough. I'll take some time tomorrow to update the code to support this use case

natecraddock commented 1 year ago

@HuM4NoiD I just pushed a commit that adds two new functions get_custom() and set_custom() to get and set custom strings. Let me know if there is anything else needed!

HuM4NoiD commented 1 year ago

Looks good, Thanks!