8000 close external command · lgrignon/typescript.java@b883096 · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b883096

Browse files
committed
close external command
1 parent 252acf5 commit b883096

File tree

5 files changed

+72
-4
lines changed

5 files changed

+72
-4
lines changed

core/ts.core/src/ts/client/CommandNames.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ public enum CommandNames implements ISupportable {
5959
GetApplicableRefactors("getApplicableRefactors", "2.4.0"),
6060
GetEditsForRefactor("getEditsForRefactor", "2.4.0"),
6161

62-
OpenExternalProject("openExternalProject");
62+
OpenExternalProject("openExternalProject"),
63+
CloseExternalProject("closeExternalProject");
6364

6465
private final String name;
6566
private final String sinceVersion;

core/ts.core/src/ts/client/ITypeScriptServiceClient.java

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,28 @@ public interface ITypeScriptServiceClient {
6464
*/
6565
void openFile(String fileName, String content, ScriptKindName scriptKindName) throws TypeScriptException;
6666

67-
void openExternalProject(String projectFileName, List<ExternalFile> rootFiles,
68-
CompilerOptions options) throws TypeScriptException;
69-
67+
/**
68+
* Open an external project based on a project name and its files with explicit
69+
* options
70+
*
71+
* @param projectFileName
72+
* @param rootFiles
73+
* @param options
74+
* @throws TypeScriptException
75+
*/
76+
void openExternalProject(String projectFileName, List<ExternalFile> rootFiles, CompilerOptions options)
77+
throws TypeScriptException;
78+
79+
/**
80+
* Closes a previously opened external project
81+
*
82+
* @see #openExternalProject(String, List, CompilerOptions)
83+
*
84+
* @param projectFileName
85+
* @throws TypeScriptException
86+
*/
87+
void closeExternalProject(String projectFileName) throws TypeScriptException;
88+
7089
/**
7190
* Close the given file name.
7291
*

core/ts.core/src/ts/client/TypeScriptServiceClient.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import ts.internal.FileTempHelper;
5656
import ts.internal.SequenceHelper;
5757
import ts.internal.client.protocol.ChangeRequest;
58+
import ts.internal.client.protocol.CloseExternalProjectRequest;
5859
import ts.internal.client.protocol.CloseRequest;
5960
import ts.internal.client.protocol.CodeFixRequest;
6061
import ts.internal.client.protocol.CompileOnSaveAffectedFileListRequest;
@@ -326,6 +327,12 @@ public void openExternalProject(String projectFileName, List<ExternalFile> rootF
326327
throws TypeScriptException {
327328
execute(new OpenExternalProjectRequest(projectFileName, rootFiles, options), false);
328329
}
330+
331+
@Override
332+
public void closeExternalProject(String projectFileName)
333+
throws TypeScriptException {
334+
execute(new CloseExternalProjectRequest(projectFileName), false);
335+
}
329336

330337
@Override
331338
public void closeFile(String fileName) throws TypeScriptException {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package ts.internal.client.protocol;
2+
3+
import com.google.gson.JsonObject;
4+
5+
import ts.client.CommandNames;
6+
7+
/**
8+
* Request to open or update external project.
9+
*
10+
* @see https://github.com/Microsoft/TypeScript/blob/master/src/server/protocol.ts
11+
*
12+
*/
13+
public class CloseExternalProjectRequest extends Request<CloseExternalProjectRequestArgs> {
14+
15+
public CloseExternalProjectRequest(String projectFileName) {
16+
super(CommandNames.CloseExternalProject.getName(),
17+
new CloseExternalProjectRequestArgs(projectFileName));
18+
}
19+
20+
@Override
21+
public Response<?> parseResponse(JsonObject json) {
22+
// This request doesn't return response.
23+
return null;
24+
}
25+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package ts.internal.client.protocol;
2+
3+
/**
4+
* @see https://github.com/Microsoft/TypeScript/blob/master/src/server/protocol.ts
5+
*/
6+
public class CloseExternalProjectRequestArgs {
7+
8+
/**
9+
* Project name
10+
*/
11+
String projectFileName;
12+
13+
public CloseExternalProjectRequestArgs(String projectFileName) {
14+
this.projectFileName = projectFileName;
15+
}
16+
}

0 commit comments

Comments
 (0)
0