1 module dls.protocol.interfaces.workspace;
2 
3 import dls.protocol.interfaces.client : RegistrationOptionsBase;
4 import dls.util.constructor : Constructor;
5 import std.json : JSONValue;
6 import std.typecons : Nullable;
7 
8 class WorkspaceFolder
9 {
10     string uri;
11     string name;
12 }
13 
14 class DidChangeWorkspaceFoldersParams
15 {
16     WorkspaceFoldersChangeEvent event;
17 }
18 
19 class WorkspaceFoldersChangeEvent
20 {
21     WorkspaceFolder[] added;
22     WorkspaceFolder[] removed;
23 }
24 
25 class DidChangeConfigurationParams
26 {
27     JSONValue settings;
28 }
29 
30 class ConfigurationParams
31 {
32     ConfigurationItem[] items;
33 
34     this(ConfigurationItem[] items = ConfigurationItem[].init)
35     {
36         this.items = items;
37     }
38 }
39 
40 class ConfigurationItem
41 {
42     Nullable!string scopeUri;
43     Nullable!string section;
44 
45     this(Nullable!string scopeUri = Nullable!string.init,
46             Nullable!string section = Nullable!string.init)
47     {
48         this.scopeUri = scopeUri;
49         this.section = section;
50     }
51 }
52 
53 class DidChangeWatchedFilesParams
54 {
55     FileEvent[] changes;
56 }
57 
58 class FileEvent
59 {
60     import dls.protocol.definitions : DocumentUri;
61 
62     DocumentUri uri;
63     FileChangeType type;
64 }
65 
66 enum FileChangeType
67 {
68     created = 1,
69     changed = 2,
70     deleted = 3
71 }
72 
73 class DidChangeWatchedFilesRegistrationOptions : RegistrationOptionsBase
74 {
75     FileSystemWatcher[] watchers;
76 
77     this(FileSystemWatcher[] watchers = FileSystemWatcher[].init)
78     {
79         this.watchers = watchers;
80     }
81 }
82 
83 class FileSystemWatcher
84 {
85     string globPattern;
86     Nullable!WatchKind kind;
87 
88     this(string globPattern = string.init, Nullable!WatchKind kind = Nullable!WatchKind.init)
89     {
90         this.globPattern = globPattern;
91         this.kind = kind;
92     }
93 }
94 
95 enum WatchKind
96 {
97     create = 1,
98     change = 2,
99     delete_ = 4
100 }
101 
102 class WorkspaceSymbolParams
103 {
104     string query;
105 }
106 
107 class ExecuteCommandParams
108 {
109     string command;
110     Nullable!(JSONValue[]) arguments;
111 }
112 
113 class ExecuteCommandRegistrationOptions : RegistrationOptionsBase
114 {
115     string[] commands;
116 
117     this(string[] commands = string[].init)
118     {
119         this.commands = commands;
120     }
121 }
122 
123 class ApplyWorkspaceEditParams
124 {
125     import dls.protocol.definitions : WorkspaceEdit;
126 
127     WorkspaceEdit edit;
128 
129     this(WorkspaceEdit edit = WorkspaceEdit.init)
130     {
131         this.edit = edit;
132     }
133 }
134 
135 class ApplyWorkspaceEditResponse
136 {
137     bool applied;
138 }