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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
#ifndef LANGUAGESERVERENTRY_H
#define LANGUAGESERVERENTRY_H
#include "LSPNetwork.h"
#include "cl_config.h"
#include <map>
#include <vector>
#include <wx/string.h>
#include <wxStringHash.h>
class LanguageServerEntry
{
bool m_enabled = true;
wxString m_name;
wxString m_exepath;
wxString m_args;
wxString m_workingDirectory;
wxArrayString m_languages;
wxString m_connectionString;
int m_priority = 50;
wxStringSet_t m_unimplementedMethods;
bool m_disaplayDiagnostics = true;
wxString m_command;
public:
// use 'map' to keep the items sorted by name
typedef std::map<wxString, LanguageServerEntry> Map_t;
/**
* @brief try to validate the LSP by checking that all paths do exists
* @return
*/
bool IsValid() const;
public:
virtual void FromJSON(const JSONItem& json);
virtual JSONItem ToJSON() const;
LanguageServerEntry();
virtual ~LanguageServerEntry();
const wxStringSet_t& GetUnimplementedMethods() const { return m_unimplementedMethods; }
void SetCommand(const wxString& command) { this->m_command = command; }
const wxString& GetCommand() const { return m_command; }
/**
* @brief add unimplemented method to this LSP
* @param methodName
*/
void AddUnImplementedMethod(const wxString& methodName);
LanguageServerEntry& SetDisaplayDiagnostics(bool disaplayDiagnostics)
{
this->m_disaplayDiagnostics = disaplayDiagnostics;
return *this;
}
bool IsDisaplayDiagnostics() const { return m_disaplayDiagnostics; }
LanguageServerEntry& SetConnectionString(const wxString& connectionString)
{
this->m_connectionString = connectionString;
return *this;
}
const wxString& GetConnectionString() const { return m_connectionString; }
LanguageServerEntry& SetPriority(int priority)
{
this->m_priority = priority;
return *this;
}
int GetPriority() const { return m_priority; }
LanguageServerEntry& SetEnabled(bool enabled)
{
this->m_enabled = enabled;
return *this;
}
bool IsEnabled() const { return m_enabled; }
LanguageServerEntry& SetLanguages(const wxArrayString& languages)
{
this->m_languages = languages;
return *this;
}
const wxArrayString& GetLanguages() const { return m_languages; }
LanguageServerEntry& SetWorkingDirectory(const wxString& workingDirectory)
{
this->m_workingDirectory = workingDirectory;
return *this;
}
const wxString& GetWorkingDirectory() const { return m_workingDirectory; }
LanguageServerEntry& SetName(const wxString& name)
{
this->m_name = name;
return *this;
}
const wxString& GetName() const { return m_name; }
eNetworkType GetNetType() const;
bool IsAutoRestart() const;
};
#endif // LANGUAGESERVERENTRY_H
|