Commit 62671a7 1 parent 0460ccd commit 62671a7 Copy full SHA for 62671a7
File tree 1 file changed +15
-1
lines changed
lua/neorg/modules/core/dirman
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ module.public = {
162
162
get_workspace = function (name )
163
163
return module .config .public .workspaces [name ]
164
164
end ,
165
- --- Returns a table in the format { "workspace_name", "path" }
165
+ --- @return { [1] : string , [2] : PathlibPath }
166
166
get_current_workspace = function ()
167
167
return module .private .current_workspace
168
168
end ,
@@ -472,6 +472,20 @@ module.public = {
472
472
end )
473
473
end
474
474
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 ,
475
489
}
476
490
477
491
module .on_event = function (event )
You can’t perform that action at this time.
0 commit comments