1 /*
2  *Copyright (C) 2018 Laurent Tréguier
3  *
4  *This file is part of DLS.
5  *
6  *DLS is free software: you can redistribute it and/or modify
7  *it under the terms of the GNU General Public License as published by
8  *the Free Software Foundation, either version 3 of the License, or
9  *(at your option) any later version.
10  *
11  *DLS is distributed in the hope that it will be useful,
12  *but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *GNU General Public License for more details.
15  *
16  *You should have received a copy of the GNU General Public License
17  *along with DLS.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 module dls.protocol.interfaces.workspace;
22 
23 import dls.protocol.interfaces.client : RegistrationOptions;
24 
25 final class WorkspaceFolder
26 {
27     import dls.protocol.definitions : DocumentUri;
28 
29     DocumentUri uri;
30     string name;
31 
32     @safe this() pure nothrow
33     {
34     }
35 }
36 
37 final class DidChangeWorkspaceFoldersParams
38 {
39     WorkspaceFoldersChangeEvent event;
40 
41     @safe this() pure nothrow
42     {
43     }
44 }
45 
46 final class WorkspaceFoldersChangeEvent
47 {
48     WorkspaceFolder[] added;
49     WorkspaceFolder[] removed;
50 
51     @safe this() pure nothrow
52     {
53     }
54 }
55 
56 final class DidChangeConfigurationParams
57 {
58     import std.json : JSONValue;
59 
60     JSONValue settings;
61 
62     @safe this() pure nothrow
63     {
64     }
65 }
66 
67 final class ConfigurationParams
68 {
69     ConfigurationItem[] items;
70 
71     @safe this(ConfigurationItem[] items = ConfigurationItem[].init) pure nothrow
72     {
73         this.items = items;
74     }
75 }
76 
77 final class ConfigurationItem
78 {
79     import dls.protocol.definitions : DocumentUri;
80     import dls.util.nullable: Nullable;
81 
82     Nullable!DocumentUri scopeUri;
83     Nullable!string section;
84 
85     @safe this(Nullable!DocumentUri scopeUri = Nullable!DocumentUri.init,
86             Nullable!string section = Nullable!string.init) pure nothrow
87     {
88         this.scopeUri = scopeUri;
89         this.section = section;
90     }
91 }
92 
93 final class DidChangeWatchedFilesParams
94 {
95     FileEvent[] changes;
96 
97     @safe this() pure nothrow
98     {
99     }
100 }
101 
102 final class FileEvent
103 {
104     import dls.protocol.definitions : DocumentUri;
105 
106     DocumentUri uri;
107     FileChangeType type;
108 
109     @safe this() pure nothrow
110     {
111     }
112 }
113 
114 enum FileChangeType : ubyte
115 {
116     created = 1,
117     changed = 2,
118     deleted = 3
119 }
120 
121 final class DidChangeWatchedFilesRegistrationOptions : RegistrationOptions
122 {
123     FileSystemWatcher[] watchers;
124 
125     @safe this(FileSystemWatcher[] watchers = FileSystemWatcher[].init) pure nothrow
126     {
127         this.watchers = watchers;
128     }
129 }
130 
131 final class FileSystemWatcher
132 {
133     import dls.util.nullable: Nullable;
134 
135     string globPattern;
136     Nullable!ubyte kind;
137 
138     @safe this(string globPattern = string.init, Nullable!ubyte kind = Nullable!ubyte.init) pure nothrow
139     {
140         this.globPattern = globPattern;
141         this.kind = kind;
142     }
143 }
144 
145 enum WatchKind : ubyte
146 {
147     create = 1,
148     change = 2,
149     delete_ = 4
150 }
151 
152 final class WorkspaceSymbolParams
153 {
154     string query;
155 
156     @safe this() pure nothrow
157     {
158     }
159 }
160 
161 final class ExecuteCommandParams
162 {
163     import std.json : JSONValue;
164     import dls.util.nullable: Nullable;
165 
166     string command;
167     Nullable!(JSONValue[]) arguments;
168 
169     @safe this() pure nothrow
170     {
171     }
172 }
173 
174 final class ExecuteCommandRegistrationOptions : RegistrationOptions
175 {
176     string[] commands;
177 
178     @safe this(string[] commands = string[].init) pure nothrow
179     {
180         this.commands = commands;
181     }
182 }
183 
184 final class ApplyWorkspaceEditParams
185 {
186     import dls.protocol.definitions : WorkspaceEdit;
187 
188     WorkspaceEdit edit;
189 
190     @safe this(WorkspaceEdit edit = WorkspaceEdit.init) pure nothrow
191     {
192         this.edit = edit;
193     }
194 }
195 
196 final class ApplyWorkspaceEditResponse
197 {
198     bool applied;
199 
200     @safe this() pure nothrow
201     {
202     }
203 }