Debian Codegraph @

LanguageServer/LSPTypeScriptDetector.cpp

raw
1 #include "LSPTypeScriptDetector.hpp"
2 #include "NodeJSLocator.h"
3 #include "clNodeJS.h"
4 #include "fileutils.h"
5 #include "globals.h"
6
7 LSPTypeScriptDetector::LSPTypeScriptDetector()
8 : LSPDetector("TypeScript")
9 {
10 }
11
12 LSPTypeScriptDetector::~LSPTypeScriptDetector() {}
13
14 bool LSPTypeScriptDetector::DoLocate()
15 {
16 wxFileName typescript_lsp;
17 wxArrayString hints;
18
19 wxString fullname = "typescript-language-server";
20 #ifdef __WXMSW__
21 wxFileName roaming(clStandardPaths::Get().GetUserDataDir(), wxEmptyString);
22 roaming.RemoveLastDir();
23 roaming.AppendDir("npm");
24 hints.Add(roaming.GetPath());
25 fullname << ".cmd";
26 #endif
27
28 if(!FileUtils::FindExe(fullname, typescript_lsp, hints)) {
29 return false;
30 }
31
32 wxString command;
33 command << typescript_lsp.GetFullPath();
34 WrapWithQuotes(command);
35
36 command << " --stdio";
37 SetCommand(command);
38 wxArrayString langs;
39 langs.Add("javascript");
40 langs.Add("typescript");
41 SetLangugaes(langs);
42 SetConnectionString("stdio");
43 SetPriority(100);
44 return true;
45 }