Skip to content
This repository was archived by the owner on Mar 1, 2022. It is now read-only.

Commit 5f4eeb2

Browse files
author
WebFreak001
committed
bump to v2.6.0: Added fsworkspace (fix #12)
1 parent e2401a2 commit 5f4eeb2

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

source/app.d

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import std.json;
1616
import std.meta;
1717
import std.conv;
1818

19-
static immutable Version = [2, 5, 0];
19+
static immutable Version = [2, 6, 0];
2020
__gshared Mutex writeMutex, commandMutex;
2121

2222
void sendFinal(int id, JSONValue value)
@@ -241,6 +241,7 @@ void handleRequest(int id, JSONValue request)
241241
handleRequestMod!(workspaced.com.dfmt)(id, request, values, asyncWaiting, isAsync, hasArgs, asyncCallback);
242242
handleRequestMod!(workspaced.com.dscanner)(id, request, values, asyncWaiting, isAsync, hasArgs, asyncCallback);
243243
handleRequestMod!(workspaced.com.dlangui)(id, request, values, asyncWaiting, isAsync, hasArgs, asyncCallback);
244+
handleRequestMod!(workspaced.com.fsworkspace)(id, request, values, asyncWaiting, isAsync, hasArgs, asyncCallback);
244245

245246
if (isAsync)
246247
{

source/com/fsworkspace.d

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
module workspaced.com.fsworkspace;
2+
3+
import std.json;
4+
import workspaced.api;
5+
6+
@component("fsworkspace") :
7+
8+
/// Load function for custom import management. Call with `{"cmd": "load", "components": ["fsworkspace"]}`
9+
/// Calling this will make fsworkspace the (string) import path provider!
10+
@load void start(string dir, string[] additionalPaths = [])
11+
{
12+
paths = dir ~ additionalPaths;
13+
importPathProvider = &imports;
14+
stringImportPathProvider = &imports;
15+
}
16+
17+
/// Unloads allocated strings
18+
@unload void stop()
19+
{
20+
paths.length = 0;
21+
}
22+
23+
/// Adds new (string) import paths to the workspace
24+
/// Call_With: `{"subcmd": "add:imports"}`
25+
@arguments("subcmd", "add:imports")
26+
void addImports(string[] values)
27+
{
28+
paths ~= values;
29+
}
30+
31+
/// Lists all (string) import paths
32+
/// Call_With: `{"subcmd": "list:import"}`
33+
@arguments("subcmd", "list:import")
34+
string[] imports()
35+
{
36+
return paths;
37+
}
38+
39+
__gshared:
40+
string[] paths;

0 commit comments

Comments
 (0)