File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
lua/neorg/modules/core/dirman Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ module.public = {
162162 get_workspace = function (name )
163163 return module .config .public .workspaces [name ]
164164 end ,
165- --- Returns a table in the format { "workspace_name", "path" }
165+ --- @return { [1] : string , [2] : PathlibPath }
166166 get_current_workspace = function ()
167167 return module .private .current_workspace
168168 end ,
@@ -472,6 +472,20 @@ module.public = {
472472 end )
473473 end
474474 end ,
475+
476+ --- Is the file a part of the given workspace?
477+ --- @param file PathlibPath
478+ --- @param workspace_name string ? workspace or current ws when nil
479+ --- @return boolean
480+ in_workspace = function (file , workspace_name )
481+ local ws_path
482+ if not workspace_name then
483+ ws_path = module .private .current_workspace [2 ]
484+ else
485+ ws_path = module .public .get_workspace (workspace_name )
486+ end
487+ return not not file :match (" ^" .. ws_path )
488+ end ,
475489}
476490
477491module .on_event = function (event )
You can’t perform that action at this time.
0 commit comments