Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTutorialMain.java
More file actions
Latest commit
41 lines (32 loc) · 1.46 KB
/
Copy pathTutorialMain.java
File metadata and controls
41 lines (32 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
importorg.eclipse.lsp4j.jsonrpc.messages.Either;
importmagpiebridge.core.IProjectService;
importmagpiebridge.core.MagpieServer;
importmagpiebridge.core.ServerAnalysis;
importmagpiebridge.core.ServerConfiguration;
importmagpiebridge.core.ToolAnalysis;
importmagpiebridge.projectservice.java.JavaProjectService;
publicclassTutorialMain {
publicstaticvoidmain(String... args) {
StringpreparedFile = args[0];
// launch the server, here we choose stand I/O. Note later don't use System.out
// to print text messages to console, it will block the channel.
createServer(preparedFile).launchOnStdio();
// for debugging
//MagpieServer.launchOnSocketPort(5007, () -> createServer(preparedFile));
}
privatestaticMagpieServercreateServer(StringpreparedFile) {
// set up configuration for MagpieServer
ServerConfigurationdefaultConfig = newServerConfiguration();
MagpieServerserver = newMagpieServer(defaultConfig);
// define which language you consider and add a project service for this
// language
Stringlanguage = "java";
IProjectServicejavaProjectService = newJavaProjectService();
// add your customized analysis to the MagpieServer
ServerAnalysismyAnalysis = newMyDummyAnalysis(preparedFile);
server.addProjectService(language, javaProjectService);
Either<ServerAnalysis, ToolAnalysis> analysis = Either.forLeft(myAnalysis);
server.addAnalysis(analysis, language);
returnserver;
}
}