hoshi-lang dev
Yet another programming language
Loading...
Searching...
No Matches
DocumentStore Class Reference

#include <document.h>

Collaboration diagram for DocumentStore:

Public Member Functions

void setProjectIndex (ProjectIndex *index)
 
ProjectIndexgetProjectIndex ()
 
void setCompilerContext (std::shared_ptr< yoi::compilerContext > ctx)
 
void openDocument (const std::string &uri, const std::string &text, const std::string &languageId, int version)
 
void updateDocument (const std::string &uri, const std::string &text, int version)
 
void closeDocument (const std::string &uri)
 
DocumentgetDocument (const std::string &uri)
 
void reparseDocument (const std::string &uri)
 
const std::map< std::string, Document > & getDocuments () const
 

Private Member Functions

void resolveAndIndexImports (const std::string &uri, Document &doc)
 Resolve import/use references in the document AST and index referenced modules.
 

Private Attributes

std::map< std::string, Documentdocuments
 
ProjectIndexprojectIndex = nullptr
 
std::shared_ptr< yoi::compilerContextcompilerCtx
 

Detailed Description

Definition at line 40 of file document.h.

Member Function Documentation

◆ closeDocument()

void closeDocument ( const std::string &  uri)

Definition at line 47 of file document.cpp.

References DocumentStore::documents.

Referenced by LspServer::handleDidClose().

Here is the caller graph for this function:

◆ getDocument()

Document * getDocument ( const std::string &  uri)

◆ getDocuments()

const std::map< std::string, Document > & getDocuments ( ) const
inline

Definition at line 54 of file document.h.

References DocumentStore::documents.

◆ getProjectIndex()

ProjectIndex * getProjectIndex ( )
inline

Definition at line 43 of file document.h.

References DocumentStore::projectIndex.

◆ openDocument()

void openDocument ( const std::string &  uri,
const std::string &  text,
const std::string &  languageId,
int  version 
)

Definition at line 25 of file document.cpp.

References DocumentStore::documents, Document::languageId, Document::projectIndex, DocumentStore::projectIndex, DocumentStore::reparseDocument(), yoi::string2wstring(), Document::text, Document::uri, and Document::version.

Referenced by LspServer::handleDidOpen().

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

◆ reparseDocument()

◆ resolveAndIndexImports()

void resolveAndIndexImports ( const std::string &  uri,
Document doc 
)
private

Resolve import/use references in the document AST and index referenced modules.

Definition at line 160 of file document.cpp.

References Document::ast, Document::crossModuleSymbols, globalStmt::importDecl, ProjectIndex::indexAndGet(), Symbol::parentName, DocumentStore::projectIndex, ProjectIndex::resolveModule(), Symbol::sourceFile, hoshiModule::stmts, yoi::string2wstring(), globalStmt::useStmt, and yoi::wstring2string().

Referenced by DocumentStore::reparseDocument().

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

◆ setCompilerContext()

void setCompilerContext ( std::shared_ptr< yoi::compilerContext ctx)
inline

Definition at line 44 of file document.h.

References DocumentStore::compilerCtx.

Referenced by LspServer::LspServer().

Here is the caller graph for this function:

◆ setProjectIndex()

void setProjectIndex ( ProjectIndex index)
inline

Definition at line 42 of file document.h.

References DocumentStore::projectIndex.

Referenced by LspServer::LspServer().

Here is the caller graph for this function:

◆ updateDocument()

void updateDocument ( const std::string &  uri,
const std::string &  text,
int  version 
)

Definition at line 37 of file document.cpp.

References DocumentStore::documents, DocumentStore::projectIndex, DocumentStore::reparseDocument(), and yoi::string2wstring().

Referenced by LspServer::handleDidChange().

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

Member Data Documentation

◆ compilerCtx

std::shared_ptr<yoi::compilerContext> compilerCtx
private

Definition at line 59 of file document.h.

Referenced by DocumentStore::reparseDocument(), and DocumentStore::setCompilerContext().

◆ documents

◆ projectIndex


The documentation for this class was generated from the following files: