| 1 |
#ifndef JSONRPC_BASICTYPES_H |
| 2 |
#define JSONRPC_BASICTYPES_H |
| 3 |
|
| 4 |
#include "IPathConverter.hpp" |
| 5 |
#include "JSON.h" |
| 6 |
#include "JSONObject.h" |
| 7 |
#include "codelite_exports.h" |
| 8 |
#include "fileutils.h" |
| 9 |
|
| 10 |
#include <vector> |
| 11 |
#include <wx/sharedptr.h> |
| 12 |
|
| 13 |
namespace LSP |
| 14 |
{ |
| 15 |
enum eSymbolKind { |
| 16 |
kSK_File = 1, |
| 17 |
kSK_Module = 2, |
| 18 |
kSK_Namespace = 3, |
| 19 |
kSK_Package = 4, |
| 20 |
kSK_Class = 5, |
| 21 |
kSK_Method = 6, |
| 22 |
kSK_Property = 7, |
| 23 |
kSK_Field = 8, |
| 24 |
kSK_Constructor = 9, |
| 25 |
kSK_Enum = 10, |
| 26 |
kSK_Interface = 11, |
| 27 |
kSK_Function = 12, |
| 28 |
kSK_Variable = 13, |
| 29 |
kSK_Constant = 14, |
| 30 |
kSK_String = 15, |
| 31 |
kSK_Number = 16, |
| 32 |
kSK_Boolean = 17, |
| 33 |
kSK_Array = 18, |
| 34 |
kSK_Object = 19, |
| 35 |
kSK_Key = 20, |
| 36 |
kSK_Null = 21, |
| 37 |
kSK_EnumMember = 22, |
| 38 |
kSK_Struct = 23, |
| 39 |
kSK_Event = 24, |
| 40 |
kSK_Operator = 25, |
| 41 |
kSK_TypeParameter = 26, |
| 42 |
}; |
| 43 |
|
| 44 |
class WXDLLIMPEXP_CL URI |
| 45 |
{ |
| 46 |
wxString m_path; |
| 47 |
wxString m_uri; |
| 48 |
|
| 49 |
private: |
| 50 |
URI(const wxString& str) = delete; |
| 51 |
URI& operator=(const wxString& str) = delete; |
| 52 |
|
| 53 |
public: |
| 54 |
URI() {} |
| 55 |
~URI() {} |
| 56 |
|
| 57 |
static void FromString(const wxString& str, URI* o); |
| 58 |
|
| 59 |
const wxString& GetPath() const; |
| 60 |
const wxString& GetUrl() const; |
| 61 |
}; |
| 62 |
//===---------------------------------------------------------------------------------- |
| 63 |
// TextDocumentContentChangeEvent |
| 64 |
//===---------------------------------------------------------------------------------- |
| 65 |
class WXDLLIMPEXP_CL TextDocumentContentChangeEvent : public Serializable |
| 66 |
{ |
| 67 |
wxString m_text; |
| 68 |
|
| 69 |
public: |
| 70 |
virtual JSONItem ToJSON(const wxString& name) const; |
| 71 |
virtual void FromJSON(const JSONItem& json); |
| 72 |
|
| 73 |
TextDocumentContentChangeEvent() {} |
| 74 |
TextDocumentContentChangeEvent(const wxString& text) |
| 75 |
: m_text(text) |
| 76 |
{ |
| 77 |
} |
| 78 |
virtual ~TextDocumentContentChangeEvent() {} |
| 79 |
TextDocumentContentChangeEvent& SetText(const wxString& text); |
| 80 |
const wxString& GetText() const { return m_text; } |
| 81 |
}; |
| 82 |
|
| 83 |
//===---------------------------------------------------------------------------------- |
| 84 |
// TextDocumentIdentifier |
| 85 |
//===---------------------------------------------------------------------------------- |
| 86 |
class WXDLLIMPEXP_CL TextDocumentIdentifier : public Serializable |
| 87 |
{ |
| 88 |
URI m_filename; |
| 89 |
|
| 90 |
public: |
| 91 |
virtual JSONItem ToJSON(const wxString& name) const; |
| 92 |
virtual void FromJSON(const JSONItem& json); |
| 93 |
|
| 94 |
TextDocumentIdentifier() {} |
| 95 |
TextDocumentIdentifier(const wxString& filename) { URI::FromString(filename, &m_filename); } |
| 96 |
|
| 97 |
virtual ~TextDocumentIdentifier() {} |
| 98 |
TextDocumentIdentifier& SetFilename(const wxString& filename) |
| 99 |
{ |
| 100 |
URI::FromString(filename, &m_filename); |
| 101 |
return *this; |
| 102 |
} |
| 103 |
const wxString& GetPath() const { return m_filename.GetPath(); } |
| 104 |
const wxString& GetPathAsURI() const { return m_filename.GetUrl(); } |
| 105 |
}; |
| 106 |
|
| 107 |
//===---------------------------------------------------------------------------------- |
| 108 |
// VersionedTextDocumentIdentifier |
| 109 |
//===---------------------------------------------------------------------------------- |
| 110 |
class WXDLLIMPEXP_CL VersionedTextDocumentIdentifier : public TextDocumentIdentifier |
| 111 |
{ |
| 112 |
int m_version = 1; |
| 113 |
|
| 114 |
public: |
| 115 |
virtual JSONItem ToJSON(const wxString& name) const; |
| 116 |
virtual void FromJSON(const JSONItem& json); |
| 117 |
|
| 118 |
VersionedTextDocumentIdentifier() {} |
| 119 |
VersionedTextDocumentIdentifier(int version) |
| 120 |
: m_version(version) |
| 121 |
{ |
| 122 |
} |
| 123 |
virtual ~VersionedTextDocumentIdentifier() {} |
| 124 |
VersionedTextDocumentIdentifier& SetVersion(int version) |
| 125 |
{ |
| 126 |
this->m_version = version; |
| 127 |
return *this; |
| 128 |
} |
| 129 |
int GetVersion() const { return m_version; } |
| 130 |
}; |
| 131 |
|
| 132 |
//===---------------------------------------------------------------------------------- |
| 133 |
// Position |
| 134 |
//===---------------------------------------------------------------------------------- |
| 135 |
class WXDLLIMPEXP_CL Position : public Serializable |
| 136 |
{ |
| 137 |
int m_line = wxNOT_FOUND; |
| 138 |
int m_character = wxNOT_FOUND; |
| 139 |
|
| 140 |
public: |
| 141 |
virtual void FromJSON(const JSONItem& json); |
| 142 |
virtual JSONItem ToJSON(const wxString& name) const; |
| 143 |
|
| 144 |
Position(int line, int col) |
| 145 |
: m_line(line) |
| 146 |
, m_character(col) |
| 147 |
{ |
| 148 |
} |
| 149 |
Position() {} |
| 150 |
virtual ~Position() {} |
| 151 |
bool operator==(const Position& rhs) const |
| 152 |
{ |
| 153 |
return this->m_line == rhs.m_line && this->m_character == rhs.m_character; |
| 154 |
} |
| 155 |
bool operator!=(const Position& rhs) const { return !(*this == rhs); } |
| 156 |
bool operator<(const Position& rhs) const |
| 157 |
{ |
| 158 |
if(this->m_line == rhs.m_line) { |
| 159 |
return this->m_character < rhs.m_character; |
| 160 |
} else { |
| 161 |
return this->m_line < rhs.m_line; |
| 162 |
} |
| 163 |
} |
| 164 |
bool operator>(const Position& rhs) const { return rhs < *this; } |
| 165 |
bool operator<=(const Position& rhs) const { return !(*this > rhs); } |
| 166 |
bool operator>=(const Position& rhs) const { return !(*this < rhs); } |
| 167 |
Position& SetCharacter(int character) |
| 168 |
{ |
| 169 |
this->m_character = character; |
| 170 |
return *this; |
| 171 |
} |
| 172 |
Position& SetLine(int line) |
| 173 |
{ |
| 174 |
this->m_line = line; |
| 175 |
return *this; |
| 176 |
} |
| 177 |
int GetCharacter() const { return m_character; } |
| 178 |
int GetLine() const { return m_line; } |
| 179 |
bool IsOk() const { return m_line != wxNOT_FOUND && m_character != wxNOT_FOUND; } |
| 180 |
}; |
| 181 |
|
| 182 |
//===---------------------------------------------------------------------------------- |
| 183 |
// Range |
| 184 |
//===---------------------------------------------------------------------------------- |
| 185 |
class WXDLLIMPEXP_CL Range : public Serializable |
| 186 |
{ |
| 187 |
Position m_start; |
| 188 |
Position m_end; |
| 189 |
|
| 190 |
public: |
| 191 |
virtual void FromJSON(const JSONItem& json); |
| 192 |
virtual JSONItem ToJSON(const wxString& name) const; |
| 193 |
|
| 194 |
Range(const Position& start, const Position& end) |
| 195 |
: m_start(start) |
| 196 |
, m_end(end) |
| 197 |
{ |
| 198 |
} |
| 199 |
Range() {} |
| 200 |
virtual ~Range() {} |
| 201 |
Range& SetEnd(const Position& end) |
| 202 |
{ |
| 203 |
this->m_end = end; |
| 204 |
return *this; |
| 205 |
} |
| 206 |
Range& SetStart(const Position& start) |
| 207 |
{ |
| 208 |
this->m_start = start; |
| 209 |
return *this; |
| 210 |
} |
| 211 |
const Position& GetEnd() const { return m_end; } |
| 212 |
const Position& GetStart() const { return m_start; } |
| 213 |
bool IsOk() const { return m_start.IsOk() && m_end.IsOk(); } |
| 214 |
}; |
| 215 |
|
| 216 |
//===---------------------------------------------------------------------------------- |
| 217 |
// TextEdit |
| 218 |
//===---------------------------------------------------------------------------------- |
| 219 |
|
| 220 |
class WXDLLIMPEXP_CL TextEdit : public LSP::Serializable |
| 221 |
{ |
| 222 |
Range m_range; |
| 223 |
wxString m_newText; |
| 224 |
|
| 225 |
public: |
| 226 |
TextEdit() {} |
| 227 |
virtual ~TextEdit() {} |
| 228 |
virtual void FromJSON(const JSONItem& json); |
| 229 |
virtual JSONItem ToJSON(const wxString& name) const; |
| 230 |
void SetNewText(const wxString& newText) { this->m_newText = newText; } |
| 231 |
void SetRange(const Range& range) { this->m_range = range; } |
| 232 |
const wxString& GetNewText() const { return m_newText; } |
| 233 |
const Range& GetRange() const { return m_range; } |
| 234 |
bool IsOk() const { return m_range.IsOk(); } |
| 235 |
}; |
| 236 |
|
| 237 |
class WXDLLIMPEXP_CL Location : public Serializable |
| 238 |
{ |
| 239 |
URI m_uri; |
| 240 |
Range m_range; |
| 241 |
wxString m_pattern; |
| 242 |
wxString m_name; |
| 243 |
|
| 244 |
public: |
| 245 |
virtual void FromJSON(const JSONItem& json); |
| 246 |
virtual JSONItem ToJSON(const wxString& name) const; |
| 247 |
|
| 248 |
Location(const wxString& uri, const Range& range) |
| 249 |
: m_range(range) |
| 250 |
{ |
| 251 |
URI::FromString(uri, &m_uri); |
| 252 |
} |
| 253 |
|
| 254 |
Location() {} |
| 255 |
virtual ~Location() {} |
| 256 |
Location& SetRange(const Range& range) |
| 257 |
{ |
| 258 |
this->m_range = range; |
| 259 |
return *this; |
| 260 |
} |
| 261 |
Location& SetPath(const wxString& path) |
| 262 |
{ |
| 263 |
URI::FromString(path, &m_uri); |
| 264 |
return *this; |
| 265 |
} |
| 266 |
|
| 267 |
const Range& GetRange() const { return m_range; } |
| 268 |
const wxString& GetPathAsURI() const { return m_uri.GetUrl(); } |
| 269 |
const wxString& GetPath() const { return m_uri.GetPath(); } |
| 270 |
void SetPattern(const wxString& pattern) { this->m_pattern = pattern; } |
| 271 |
const wxString& GetPattern() const { return m_pattern; } |
| 272 |
void SetName(const wxString& name) { this->m_name = name; } |
| 273 |
const wxString& GetName() const { return m_name; } |
| 274 |
}; |
| 275 |
|
| 276 |
//===---------------------------------------------------------------------------------- |
| 277 |
// TextDocumentItem |
| 278 |
//===---------------------------------------------------------------------------------- |
| 279 |
class WXDLLIMPEXP_CL TextDocumentItem : public Serializable |
| 280 |
{ |
| 281 |
URI m_uri; |
| 282 |
wxString m_languageId; |
| 283 |
wxString m_text; |
| 284 |
int m_version = 1; |
| 285 |
|
| 286 |
public: |
| 287 |
virtual void FromJSON(const JSONItem& json); |
| 288 |
virtual JSONItem ToJSON(const wxString& name) const; |
| 289 |
|
| 290 |
TextDocumentItem(const wxString& uri, const wxString& langId, const wxString& text, int version = 1) |
| 291 |
: m_languageId(langId) |
| 292 |
, m_text(text) |
| 293 |
, m_version(version) |
| 294 |
{ |
| 295 |
URI::FromString(uri, &m_uri); |
| 296 |
} |
| 297 |
|
| 298 |
TextDocumentItem() {} |
| 299 |
virtual ~TextDocumentItem() {} |
| 300 |
TextDocumentItem& SetLanguageId(const wxString& languageId) |
| 301 |
{ |
| 302 |
this->m_languageId = languageId; |
| 303 |
return *this; |
| 304 |
} |
| 305 |
TextDocumentItem& SetText(const std::string& text) |
| 306 |
{ |
| 307 |
this->m_text = text; |
| 308 |
return *this; |
| 309 |
} |
| 310 |
TextDocumentItem& SetUri(const wxString& uri) |
| 311 |
{ |
| 312 |
URI::FromString(uri, &m_uri); |
| 313 |
return *this; |
| 314 |
} |
| 315 |
|
| 316 |
TextDocumentItem& SetVersion(int version) |
| 317 |
{ |
| 318 |
this->m_version = version; |
| 319 |
return *this; |
| 320 |
} |
| 321 |
const wxString& GetLanguageId() const { return m_languageId; } |
| 322 |
const wxString& GetText() const { return m_text; } |
| 323 |
const wxString& GetPathAsURI() const { return m_uri.GetUrl(); } |
| 324 |
const wxString& GetPath() const { return m_uri.GetPath(); } |
| 325 |
int GetVersion() const { return m_version; } |
| 326 |
}; |
| 327 |
|
| 328 |
class WXDLLIMPEXP_CL ParameterInformation : public LSP::Serializable |
| 329 |
{ |
| 330 |
wxString m_label; |
| 331 |
wxString m_documentation; |
| 332 |
|
| 333 |
public: |
| 334 |
ParameterInformation() {} |
| 335 |
virtual ~ParameterInformation() {} |
| 336 |
ParameterInformation& SetDocumentation(const wxString& documentation) |
| 337 |
{ |
| 338 |
this->m_documentation = documentation; |
| 339 |
return *this; |
| 340 |
} |
| 341 |
ParameterInformation& SetLabel(const wxString& label) |
| 342 |
{ |
| 343 |
this->m_label = label; |
| 344 |
return *this; |
| 345 |
} |
| 346 |
const wxString& GetDocumentation() const { return m_documentation; } |
| 347 |
const wxString& GetLabel() const { return m_label; } |
| 348 |
virtual void FromJSON(const JSONItem& json); |
| 349 |
virtual JSONItem ToJSON(const wxString& name) const; |
| 350 |
|
| 351 |
typedef std::vector<ParameterInformation> Vec_t; |
| 352 |
}; |
| 353 |
|
| 354 |
class WXDLLIMPEXP_CL SignatureInformation : public LSP::Serializable |
| 355 |
{ |
| 356 |
wxString m_label; |
| 357 |
wxString m_documentation; |
| 358 |
ParameterInformation::Vec_t m_parameters; |
| 359 |
|
| 360 |
public: |
| 361 |
typedef std::vector<LSP::SignatureInformation> Vec_t; |
| 362 |
|
| 363 |
public: |
| 364 |
SignatureInformation() {} |
| 365 |
virtual ~SignatureInformation() {} |
| 366 |
SignatureInformation& SetParameters(const ParameterInformation::Vec_t& parameters) |
| 367 |
{ |
| 368 |
this->m_parameters = parameters; |
| 369 |
return *this; |
| 370 |
} |
| 371 |
const ParameterInformation::Vec_t& GetParameters() const { return m_parameters; } |
| 372 |
SignatureInformation& SetDocumentation(const wxString& documentation) |
| 373 |
{ |
| 374 |
this->m_documentation = documentation; |
| 375 |
return *this; |
| 376 |
} |
| 377 |
SignatureInformation& SetLabel(const wxString& label) |
| 378 |
{ |
| 379 |
this->m_label = label; |
| 380 |
return *this; |
| 381 |
} |
| 382 |
const wxString& GetDocumentation() const { return m_documentation; } |
| 383 |
const wxString& GetLabel() const { return m_label; } |
| 384 |
virtual void FromJSON(const JSONItem& json); |
| 385 |
virtual JSONItem ToJSON(const wxString& name) const; |
| 386 |
}; |
| 387 |
|
| 388 |
class WXDLLIMPEXP_CL SignatureHelp : public LSP::Serializable |
| 389 |
{ |
| 390 |
SignatureInformation::Vec_t m_signatures; |
| 391 |
int m_activeSignature = 0; |
| 392 |
int m_activeParameter = 0; |
| 393 |
|
| 394 |
public: |
| 395 |
SignatureHelp() {} |
| 396 |
virtual ~SignatureHelp() {} |
| 397 |
|
| 398 |
SignatureHelp& SetActiveParameter(int activeParameter) |
| 399 |
{ |
| 400 |
this->m_activeParameter = activeParameter; |
| 401 |
return *this; |
| 402 |
} |
| 403 |
SignatureHelp& SetActiveSignature(int activeSignature) |
| 404 |
{ |
| 405 |
this->m_activeSignature = activeSignature; |
| 406 |
return *this; |
| 407 |
} |
| 408 |
SignatureHelp& SetSignatures(const SignatureInformation::Vec_t& signatures) |
| 409 |
{ |
| 410 |
this->m_signatures = signatures; |
| 411 |
return *this; |
| 412 |
} |
| 413 |
int GetActiveParameter() const { return m_activeParameter; } |
| 414 |
int GetActiveSignature() const { return m_activeSignature; } |
| 415 |
const SignatureInformation::Vec_t& GetSignatures() const { return m_signatures; } |
| 416 |
virtual void FromJSON(const JSONItem& json); |
| 417 |
virtual JSONItem ToJSON(const wxString& name) const; |
| 418 |
}; |
| 419 |
|
| 420 |
class WXDLLIMPEXP_CL MarkupContent : public LSP::Serializable |
| 421 |
{ |
| 422 |
wxString m_kind; |
| 423 |
wxString m_value; |
| 424 |
|
| 425 |
public: |
| 426 |
MarkupContent() {} |
| 427 |
virtual ~MarkupContent() {} |
| 428 |
MarkupContent& SetKind(const wxString& kind) |
| 429 |
{ |
| 430 |
this->m_kind = kind; |
| 431 |
return *this; |
| 432 |
} |
| 433 |
const wxString& GetKind() const { return m_kind; } |
| 434 |
MarkupContent& SetValue(const wxString& value) |
| 435 |
{ |
| 436 |
this->m_value = value; |
| 437 |
return *this; |
| 438 |
} |
| 439 |
const wxString& GetValue() const { return m_value; } |
| 440 |
virtual void FromJSON(const JSONItem& json); |
| 441 |
virtual JSONItem ToJSON(const wxString& name) const; |
| 442 |
}; |
| 443 |
|
| 444 |
class WXDLLIMPEXP_CL Hover : public LSP::Serializable |
| 445 |
{ |
| 446 |
MarkupContent m_contents; |
| 447 |
Range m_range; |
| 448 |
|
| 449 |
public: |
| 450 |
Hover() {} |
| 451 |
virtual ~Hover() {} |
| 452 |
Hover& SetContents(const MarkupContent& contents) |
| 453 |
{ |
| 454 |
this->m_contents = contents; |
| 455 |
return *this; |
| 456 |
} |
| 457 |
const MarkupContent& GetContents() const { return m_contents; } |
| 458 |
Hover& SetRange(const Range& range) |
| 459 |
{ |
| 460 |
this->m_range = range; |
| 461 |
return *this; |
| 462 |
} |
| 463 |
const Range& GetRange() const { return m_range; } |
| 464 |
virtual void FromJSON(const JSONItem& json); |
| 465 |
virtual JSONItem ToJSON(const wxString& name) const; |
| 466 |
}; |
| 467 |
|
| 468 |
class WXDLLIMPEXP_CL Diagnostic : public Serializable |
| 469 |
{ |
| 470 |
Range m_range; |
| 471 |
wxString m_message; |
| 472 |
|
| 473 |
public: |
| 474 |
virtual void FromJSON(const JSONItem& json); |
| 475 |
virtual JSONItem ToJSON(const wxString& name) const; |
| 476 |
|
| 477 |
Diagnostic(const Range& range, const wxString& message) |
| 478 |
: m_range(range) |
| 479 |
, m_message(message) |
| 480 |
{ |
| 481 |
} |
| 482 |
Diagnostic() {} |
| 483 |
virtual ~Diagnostic() {} |
| 484 |
Diagnostic& SetRange(const Range& range) |
| 485 |
{ |
| 486 |
this->m_range = range; |
| 487 |
return *this; |
| 488 |
} |
| 489 |
const Range& GetRange() const { return m_range; } |
| 490 |
Diagnostic& SetMessage(const wxString& message) |
| 491 |
{ |
| 492 |
this->m_message = message; |
| 493 |
return *this; |
| 494 |
} |
| 495 |
const wxString& GetMessage() const { return m_message; } |
| 496 |
}; |
| 497 |
|
| 498 |
class WXDLLIMPEXP_CL DocumentSymbol : public Serializable |
| 499 |
{ |
| 500 |
/** |
| 501 |
* The name of this symbol. Will be displayed in the user interface and therefore must not be |
| 502 |
* an empty string or a string only consisting of white spaces. |
| 503 |
*/ |
| 504 |
wxString name; |
| 505 |
|
| 506 |
/** |
| 507 |
* More detail for this symbol, e.g the signature of a function. |
| 508 |
*/ |
| 509 |
wxString detail; |
| 510 |
|
| 511 |
/** |
| 512 |
* The kind of this symbol. |
| 513 |
*/ |
| 514 |
eSymbolKind kind; |
| 515 |
|
| 516 |
/** |
| 517 |
* The range enclosing this symbol not including leading/trailing whitespace but everything else |
| 518 |
* like comments. This information is typically used to determine if the clients cursor is |
| 519 |
* inside the symbol to reveal in the symbol in the UI. |
| 520 |
*/ |
| 521 |
Range range; |
| 522 |
|
| 523 |
/** |
| 524 |
* The range that should be selected and revealed when this symbol is being picked, e.g the name of a function. |
| 525 |
* Must be contained by the `range`. |
| 526 |
*/ |
| 527 |
Range selectionRange; |
| 528 |
|
| 529 |
/** |
| 530 |
* Children of this symbol, e.g. properties of a class. |
| 531 |
*/ |
| 532 |
std::vector<DocumentSymbol> children; |
| 533 |
|
| 534 |
public: |
| 535 |
virtual void FromJSON(const JSONItem& json); |
| 536 |
virtual JSONItem ToJSON(const wxString& name) const; |
| 537 |
|
| 538 |
DocumentSymbol() {} |
| 539 |
virtual ~DocumentSymbol() {} |
| 540 |
|
| 541 |
void SetChildren(const std::vector<DocumentSymbol>& children) { this->children = children; } |
| 542 |
void SetDetail(const wxString& detail) { this->detail = detail; } |
| 543 |
void SetKind(const eSymbolKind& kind) { this->kind = kind; } |
| 544 |
void SetName(const wxString& name) { this->name = name; } |
| 545 |
void SetRange(const Range& range) { this->range = range; } |
| 546 |
void SetSelectionRange(const Range& selectionRange) { this->selectionRange = selectionRange; } |
| 547 |
const std::vector<DocumentSymbol>& GetChildren() const { return children; } |
| 548 |
const wxString& GetDetail() const { return detail; } |
| 549 |
const eSymbolKind& GetKind() const { return kind; } |
| 550 |
const wxString& GetName() const { return name; } |
| 551 |
const Range& GetRange() const { return range; } |
| 552 |
const Range& GetSelectionRange() const { return selectionRange; } |
| 553 |
}; |
| 554 |
|
| 555 |
class WXDLLIMPEXP_CL SymbolInformation : public Serializable |
| 556 |
{ |
| 557 |
/** |
| 558 |
* The name of this symbol. |
| 559 |
*/ |
| 560 |
wxString name; |
| 561 |
|
| 562 |
/** |
| 563 |
* The kind of this symbol. |
| 564 |
*/ |
| 565 |
eSymbolKind kind; |
| 566 |
|
| 567 |
/** |
| 568 |
* The location of this symbol. The location's range is used by a tool |
| 569 |
* to reveal the location in the editor. If the symbol is selected in the |
| 570 |
* tool the range's start information is used to position the cursor. So |
| 571 |
* the range usually spans more then the actual symbol's name and does |
| 572 |
* normally include things like visibility modifiers. |
| 573 |
* |
| 574 |
* The range doesn't have to denote a node range in the sense of a abstract |
| 575 |
* syntax tree. It can therefore not be used to re-construct a hierarchy of |
| 576 |
* the symbols. |
| 577 |
*/ |
| 578 |
Location location; |
| 579 |
|
| 580 |
/** |
| 581 |
* The name of the symbol containing this symbol. This information is for |
| 582 |
* user interface purposes (e.g. to render a qualifier in the user interface |
| 583 |
* if necessary). It can't be used to re-infer a hierarchy for the document |
| 584 |
* symbols. |
| 585 |
*/ |
| 586 |
wxString containerName; |
| 587 |
|
| 588 |
public: |
| 589 |
virtual void FromJSON(const JSONItem& json); |
| 590 |
virtual JSONItem ToJSON(const wxString& name) const; |
| 591 |
|
| 592 |
SymbolInformation() {} |
| 593 |
virtual ~SymbolInformation() {} |
| 594 |
|
| 595 |
void SetContainerName(const wxString& containerName) { this->containerName = containerName; } |
| 596 |
void SetKind(const eSymbolKind& kind) { this->kind = kind; } |
| 597 |
void SetLocation(const Location& location) { this->location = location; } |
| 598 |
void SetName(const wxString& name) { this->name = name; } |
| 599 |
const wxString& GetContainerName() const { return containerName; } |
| 600 |
const eSymbolKind& GetKind() const { return kind; } |
| 601 |
const Location& GetLocation() const { return location; } |
| 602 |
const wxString& GetName() const { return name; } |
| 603 |
}; |
| 604 |
|
| 605 |
}; // namespace LSP |
| 606 |
#endif // JSONRPC_BASICTYPES_H |