hoshi-lang dev
Yet another programming language
Loading...
Searching...
No Matches
lsp Namespace Reference

Classes

struct  CompletionItem
 
struct  CompletionList
 
struct  CompletionOptions
 
struct  CompletionParams
 
class  CompletionProvider
 
struct  DefinitionParams
 
class  DefinitionProvider
 
struct  DidChangeTextDocumentParams
 
struct  DidCloseTextDocumentParams
 
struct  DidOpenTextDocumentParams
 
struct  Document
 
class  DocumentStore
 
struct  DocumentSymbol
 
struct  DocumentSymbolParams
 
struct  Hover
 
struct  HoverParams
 
class  HoverProvider
 
struct  InitializeResult
 
struct  Location
 
struct  LspDiagnostic
 
class  LspServer
 
struct  MarkupContent
 
struct  Position
 
class  ProjectIndex
 
struct  PublishDiagnosticsParams
 
struct  Range
 
struct  ReferenceParams
 
struct  ServerCapabilities
 
struct  ServerInfo
 
struct  Symbol
 
class  SymbolExtractor
 
struct  TextDocumentContentChangeEvent
 
struct  TextDocumentIdentifier
 
struct  TextDocumentItem
 
struct  TextDocumentSyncOptions
 
struct  VersionedTextDocumentIdentifier
 

Typedefs

using json = nlohmann::json
 
using DefinitionResult = std::vector< Location >
 

Enumerations

enum class  CompletionItemKind {
  Text = 1 , Method = 2 , Function = 3 , Constructor = 4 ,
  Field = 5 , Variable = 6 , Class = 7 , Interface = 8 ,
  Module = 9 , Property = 10 , Unit = 11 , Value = 12 ,
  Enum = 13 , Keyword = 14 , Snippet = 15 , Color = 16 ,
  File = 17 , Reference = 18 , Folder = 19 , EnumMember = 20 ,
  Constant = 21 , Struct = 22 , Event = 23 , Operator = 24 ,
  TypeParameter = 25
}
 
enum class  SymbolKind {
  File = 1 , Module = 2 , Namespace = 3 , Package = 4 ,
  Class = 5 , Method = 6 , Property = 7 , Field = 8 ,
  Constructor = 9 , Enum = 10 , Interface = 11 , Function = 12 ,
  Variable = 13 , Constant = 14 , String = 15 , Number = 16 ,
  Boolean = 17 , Array = 18 , Object = 19 , Key = 20 ,
  Null = 21 , EnumMember = 22 , Struct = 23 , Event = 24 ,
  Operator = 25 , TypeParameter = 26
}
 
enum class  DiagnosticSeverity { Error = 1 , Warning = 2 , Information = 3 , Hint = 4 }
 
enum class  HoshiSymbolKind {
  Function , Struct , Interface , Variable ,
  TypeAlias , Enum , Module , ModuleAlias ,
  Method , Field , Constructor , Finalizer ,
  EnumMember , Import , Export , Concept_ ,
  Lambda
}
 

Functions

static std::string documentFilePath (const Document *doc)
 
static std::vector< fs::path > moduleSearchRoots (const Document *doc)
 
static std::string getReturnTypeFromIR (Document *doc, const std::string &funcName)
 
static std::string getLineText (Document *doc, int line)
 
static std::string extractWordAtPosition (const std::string &lineText, int col)
 
static Location makeLocation (const std::string &uri, yoi::indexT line, yoi::indexT column, size_t nameLen)
 
static Hover makeHoverForSymbol (const Symbol &sym)
 
void to_json (json &j, const Position &p)
 
void from_json (const json &j, Position &p)
 
void to_json (json &j, const Range &r)
 
void from_json (const json &j, Range &r)
 
void to_json (json &j, const Location &l)
 
void from_json (const json &j, Location &l)
 
void to_json (json &j, const TextDocumentIdentifier &t)
 
void from_json (const json &j, TextDocumentIdentifier &t)
 
void to_json (json &j, const VersionedTextDocumentIdentifier &t)
 
void from_json (const json &j, VersionedTextDocumentIdentifier &t)
 
void from_json (const json &j, TextDocumentItem &t)
 
void from_json (const json &j, TextDocumentContentChangeEvent &t)
 
void from_json (const json &j, DidOpenTextDocumentParams &p)
 
void from_json (const json &j, DidChangeTextDocumentParams &p)
 
void from_json (const json &j, DidCloseTextDocumentParams &p)
 
void from_json (const json &j, CompletionParams &p)
 
void to_json (json &j, const CompletionItem &c)
 
void to_json (json &j, const CompletionList &cl)
 
void from_json (const json &j, HoverParams &p)
 
void to_json (json &j, const MarkupContent &m)
 
void to_json (json &j, const Hover &h)
 
void from_json (const json &j, DefinitionParams &p)
 
void to_json (json &j, const DefinitionResult &r)
 
void from_json (const json &j, ReferenceParams &p)
 
void to_json (json &j, const DocumentSymbol &s)
 
void to_json (json &j, const LspDiagnostic &d)
 
void to_json (json &j, const PublishDiagnosticsParams &p)
 
void to_json (json &j, const TextDocumentSyncOptions &o)
 
void to_json (json &j, const CompletionOptions &o)
 
void to_json (json &j, const ServerCapabilities &c)
 
void to_json (json &j, const ServerInfo &s)
 
void to_json (json &j, const InitializeResult &r)
 
void from_json (const json &j, DocumentSymbolParams &p)
 
static int safeInt (yoi::indexT v)
 
static lsp::SymbolKind mapSymbolKind (HoshiSymbolKind k)
 
static DocumentSymbol documentSymbolFor (const Symbol &symbol)
 
static void extendRangeToInclude (Range &range, const Range &child)
 
static yoi::wstr tokenStrVal (yoi::lexer::token &tok)
 
static yoi::wstr tryExtractTypeFromExpr (yoi::rExpr *expr)
 
bool isCallableSymbol (const Symbol &symbol)
 
bool isSymbolVisibleAt (const yoi::vec< Symbol > &symbols, const Symbol &symbol, yoi::indexT line)
 

Typedef Documentation

◆ DefinitionResult

using DefinitionResult = std::vector<Location>

Definition at line 271 of file protocol.h.

◆ json

using json = nlohmann::json

Definition at line 15 of file protocol.h.

Enumeration Type Documentation

◆ CompletionItemKind

enum class CompletionItemKind
strong
Enumerator
Text 
Method 
Function 
Constructor 
Field 
Variable 
Class 
Interface 
Module 
Property 
Unit 
Value 
Enum 
Keyword 
Snippet 
Color 
File 
Reference 
Folder 
EnumMember 
Constant 
Struct 
Event 
Operator 
TypeParameter 

Definition at line 169 of file protocol.h.

◆ DiagnosticSeverity

enum class DiagnosticSeverity
strong
Enumerator
Error 
Warning 
Information 
Hint 

Definition at line 355 of file protocol.h.

◆ HoshiSymbolKind

enum class HoshiSymbolKind
strong
Enumerator
Function 
Struct 
Interface 
Variable 
TypeAlias 
Enum 
Module 
ModuleAlias 
Method 
Field 
Constructor 
Finalizer 
EnumMember 
Import 
Export 
Concept_ 
Lambda 

Definition at line 16 of file symbolExtractor.h.

◆ SymbolKind

enum class SymbolKind
strong
Enumerator
File 
Module 
Namespace 
Package 
Class 
Method 
Property 
Field 
Constructor 
Enum 
Interface 
Function 
Variable 
Constant 
String 
Number 
Boolean 
Array 
Object 
Key 
Null 
EnumMember 
Struct 
Event 
Operator 
TypeParameter 

Definition at line 301 of file protocol.h.

Function Documentation

◆ documentFilePath()

static std::string documentFilePath ( const Document doc)
static

Definition at line 16 of file completion.cpp.

References Document::uri.

Referenced by moduleSearchRoots().

Here is the caller graph for this function:

◆ documentSymbolFor()

◆ extendRangeToInclude()

static void extendRangeToInclude ( Range range,
const Range child 
)
static

Definition at line 398 of file server.cpp.

References Position::character, Range::end, and Position::line.

Referenced by LspServer::handleDocumentSymbol().

Here is the caller graph for this function:

◆ extractWordAtPosition()

static std::string extractWordAtPosition ( const std::string &  lineText,
int  col 
)
static

Definition at line 25 of file definition.cpp.

Referenced by DefinitionProvider::provide().

Here is the caller graph for this function:

◆ from_json() [1/15]

void from_json ( const json j,
CompletionParams p 
)
inline

Definition at line 164 of file protocol.h.

References CompletionParams::position, and CompletionParams::textDocument.

◆ from_json() [2/15]

void from_json ( const json j,
DefinitionParams p 
)
inline

Definition at line 265 of file protocol.h.

References DefinitionParams::position, and DefinitionParams::textDocument.

◆ from_json() [3/15]

void from_json ( const json j,
DidChangeTextDocumentParams p 
)
inline

◆ from_json() [4/15]

void from_json ( const json j,
DidCloseTextDocumentParams p 
)
inline

Definition at line 151 of file protocol.h.

References DidCloseTextDocumentParams::textDocument.

◆ from_json() [5/15]

void from_json ( const json j,
DidOpenTextDocumentParams p 
)
inline

Definition at line 133 of file protocol.h.

References DidOpenTextDocumentParams::textDocument.

◆ from_json() [6/15]

void from_json ( const json j,
DocumentSymbolParams p 
)
inline

Definition at line 474 of file protocol.h.

References DocumentSymbolParams::textDocument.

◆ from_json() [7/15]

void from_json ( const json j,
HoverParams p 
)
inline

Definition at line 232 of file protocol.h.

References HoverParams::position, and HoverParams::textDocument.

◆ from_json() [8/15]

void from_json ( const json j,
Location l 
)
inline

Definition at line 62 of file protocol.h.

References Location::range, and Location::uri.

◆ from_json() [9/15]

void from_json ( const json j,
Position p 
)
inline

Definition at line 34 of file protocol.h.

References Position::character, and Position::line.

◆ from_json() [10/15]

void from_json ( const json j,
Range r 
)
inline

Definition at line 48 of file protocol.h.

References Range::end, and Range::start.

◆ from_json() [11/15]

void from_json ( const json j,
ReferenceParams p 
)
inline

◆ from_json() [12/15]

◆ from_json() [13/15]

void from_json ( const json j,
TextDocumentIdentifier t 
)
inline

Definition at line 79 of file protocol.h.

References TextDocumentIdentifier::uri.

◆ from_json() [14/15]

void from_json ( const json j,
TextDocumentItem t 
)
inline

◆ from_json() [15/15]

void from_json ( const json j,
VersionedTextDocumentIdentifier t 
)
inline

◆ getLineText()

static std::string getLineText ( Document doc,
int  line 
)
static

Definition at line 11 of file definition.cpp.

References Document::text, and yoi::wstring2string().

Referenced by DefinitionProvider::provide().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getReturnTypeFromIR()

static std::string getReturnTypeFromIR ( Document doc,
const std::string &  funcName 
)
static

Definition at line 40 of file completion.cpp.

References Document::irModule, yoi::string2wstring(), and yoi::wstring2string().

Referenced by CompletionProvider::resolveModuleCompletionsFromText().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isCallableSymbol()

bool isCallableSymbol ( const Symbol symbol)
inline

Definition at line 54 of file symbolExtractor.h.

References Constructor, Finalizer, Function, Symbol::kind, and Method.

Referenced by isSymbolVisibleAt().

Here is the caller graph for this function:

◆ isSymbolVisibleAt()

bool isSymbolVisibleAt ( const yoi::vec< Symbol > &  symbols,
const Symbol symbol,
yoi::indexT  line 
)
inline

Definition at line 63 of file symbolExtractor.h.

References isCallableSymbol(), Symbol::isLocal, Symbol::line, Symbol::name, Symbol::ownerLine, and Symbol::parentName.

Referenced by HoverProvider::hoverOnSymbol(), CompletionProvider::memberCompletions(), DefinitionProvider::provide(), and CompletionProvider::symbolCompletions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeHoverForSymbol()

static Hover makeHoverForSymbol ( const Symbol sym)
static

◆ makeLocation()

static Location makeLocation ( const std::string &  uri,
yoi::indexT  line,
yoi::indexT  column,
size_t  nameLen 
)
static

Definition at line 36 of file definition.cpp.

References Position::character, Range::end, Position::line, Location::range, Range::start, and Location::uri.

Referenced by DefinitionProvider::provide().

Here is the caller graph for this function:

◆ mapSymbolKind()

static lsp::SymbolKind mapSymbolKind ( HoshiSymbolKind  k)
static

Definition at line 347 of file server.cpp.

References Concept_, Constructor, Enum, EnumMember, Export, Field, File, Finalizer, Function, Import, Interface, Method, Module, ModuleAlias, Object, Struct, TypeAlias, TypeParameter, and Variable.

Referenced by documentSymbolFor().

Here is the caller graph for this function:

◆ moduleSearchRoots()

static std::vector< fs::path > moduleSearchRoots ( const Document doc)
static

Definition at line 23 of file completion.cpp.

References documentFilePath(), ProjectIndex::getSearchPaths(), and Document::projectIndex.

Referenced by CompletionProvider::useModuleCompletions(), and CompletionProvider::usePathCompletions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ safeInt()

static int safeInt ( yoi::indexT  v)
static

Definition at line 342 of file server.cpp.

Referenced by documentSymbolFor().

Here is the caller graph for this function:

◆ to_json() [1/18]

◆ to_json() [2/18]

void to_json ( json j,
const CompletionList cl 
)
inline

Definition at line 219 of file protocol.h.

References CompletionList::isIncomplete, and CompletionList::items.

◆ to_json() [3/18]

void to_json ( json j,
const CompletionOptions o 
)
inline

◆ to_json() [4/18]

void to_json ( json j,
const DefinitionResult r 
)
inline

Definition at line 273 of file protocol.h.

◆ to_json() [5/18]

◆ to_json() [6/18]

void to_json ( json j,
const Hover h 
)
inline

Definition at line 251 of file protocol.h.

References Hover::contents, and Hover::range.

◆ to_json() [7/18]

void to_json ( json j,
const InitializeResult r 
)
inline

Definition at line 459 of file protocol.h.

References InitializeResult::capabilities, and InitializeResult::serverInfo.

◆ to_json() [8/18]

void to_json ( json j,
const Location l 
)
inline

Definition at line 58 of file protocol.h.

References Location::range, and Location::uri.

◆ to_json() [9/18]

void to_json ( json j,
const LspDiagnostic d 
)
inline

◆ to_json() [10/18]

void to_json ( json j,
const MarkupContent m 
)
inline

Definition at line 242 of file protocol.h.

References MarkupContent::kind, and MarkupContent::value.

◆ to_json() [11/18]

void to_json ( json j,
const Position p 
)
inline

Definition at line 30 of file protocol.h.

References Position::character, and Position::line.

◆ to_json() [12/18]

void to_json ( json j,
const PublishDiagnosticsParams p 
)
inline

◆ to_json() [13/18]

void to_json ( json j,
const Range r 
)
inline

Definition at line 44 of file protocol.h.

References Range::end, and Range::start.

◆ to_json() [14/18]

◆ to_json() [15/18]

void to_json ( json j,
const ServerInfo s 
)
inline

Definition at line 450 of file protocol.h.

References ServerInfo::name, and ServerInfo::version.

◆ to_json() [16/18]

void to_json ( json j,
const TextDocumentIdentifier t 
)
inline

Definition at line 75 of file protocol.h.

References TextDocumentIdentifier::uri.

◆ to_json() [17/18]

◆ to_json() [18/18]

void to_json ( json j,
const VersionedTextDocumentIdentifier t 
)
inline

◆ tokenStrVal()

◆ tryExtractTypeFromExpr()