|
hoshi-lang dev
Yet another programming language
|
#include <projectIndex.h>
Classes | |
| struct | IndexedModule |
Public Member Functions | |
| ProjectIndex () | |
| void | setSearchPaths (const std::vector< std::string > &paths) |
| void | addSearchPath (const std::string &path) |
| const std::vector< std::string > & | getSearchPaths () const |
| std::string | resolveModule (const std::string &importPath, const std::string &relativeToFile) |
| void | indexModule (const std::string &absolutePath) |
| const yoi::vec< Symbol > * | getModuleSymbols (const std::string &absolutePath) |
| Get symbols for a specific module. | |
| void | getAllSymbols (yoi::vec< Symbol > &out) |
| Collect all symbols from all indexed modules into flat list. | |
| const yoi::vec< Symbol > & | indexAndGet (const std::string &absolutePath) |
| Parse and index a module, then return its symbols. | |
| void | invalidateModule (const std::string &absolutePath) |
| Clear a module from the cache (e.g., when it changes on disk). | |
Private Member Functions | |
| std::string | tryResolve (const std::string &searchDir, const std::string &importPath) |
| void | parseAndIndex (const std::string &absolutePath, const std::wstring &text, IndexedModule &mod) |
Private Attributes | |
| std::vector< std::string > | searchPaths |
| std::map< std::string, IndexedModule > | modules |
Definition at line 18 of file projectIndex.h.
| ProjectIndex | ( | ) |
Definition at line 19 of file projectIndex.cpp.
| void addSearchPath | ( | const std::string & | path | ) |
Definition at line 25 of file projectIndex.cpp.
References ProjectIndex::searchPaths.
Referenced by LspServer::handleInitialize().

Collect all symbols from all indexed modules into flat list.
Definition at line 152 of file projectIndex.cpp.
References ProjectIndex::modules, Symbol::sourceFile, and yoi::string2wstring().
Referenced by CompletionProvider::completionsForType(), CompletionProvider::completionsForTypeNameFromModules(), HoverProvider::hoverOnSymbol(), and CompletionProvider::resolveModuleCompletionsFromText().


Get symbols for a specific module.
Definition at line 146 of file projectIndex.cpp.
References ProjectIndex::modules.
|
inline |
Definition at line 24 of file projectIndex.h.
References ProjectIndex::searchPaths.
Referenced by lsp::moduleSearchRoots().

Parse and index a module, then return its symbols.
Definition at line 167 of file projectIndex.cpp.
References ProjectIndex::indexModule(), and ProjectIndex::modules.
Referenced by CompletionProvider::completionsForTypeNameFromModules(), HoverProvider::hoverOnSymbol(), DocumentStore::resolveAndIndexImports(), and CompletionProvider::resolveModuleCompletionsFromText().


| void indexModule | ( | const std::string & | absolutePath | ) |
Parse and index a module file at an absolute path. Does nothing if the module is already indexed.
Definition at line 92 of file projectIndex.cpp.
References __lsp_builtin_module, ProjectIndex::modules, ProjectIndex::parseAndIndex(), yoi::string2wstring(), and ProjectIndex::IndexedModule::text.
Referenced by ProjectIndex::indexAndGet().


| void invalidateModule | ( | const std::string & | absolutePath | ) |
Clear a module from the cache (e.g., when it changes on disk).
Definition at line 177 of file projectIndex.cpp.
References yoi::finalizeAST(), and ProjectIndex::modules.

|
private |
Definition at line 123 of file projectIndex.cpp.
References yoi::__current_file_path, ProjectIndex::IndexedModule::ast, SymbolExtractor::extract(), yoi::parse(), lexer::scan(), yoi::set_current_file_path(), yoi::string2wstring(), and ProjectIndex::IndexedModule::symbols.
Referenced by ProjectIndex::indexModule().


| std::string resolveModule | ( | const std::string & | importPath, |
| const std::string & | relativeToFile | ||
| ) |
Resolve an import path string to an absolute file path.
| importPath | The path string from use/import statement (e.g. "lib/math") |
| relativeToFile | Absolute path of the file containing the import (for local search dirs) |
Definition at line 29 of file projectIndex.cpp.
References ProjectIndex::searchPaths, and ProjectIndex::tryResolve().
Referenced by DefinitionProvider::provide(), DocumentStore::resolveAndIndexImports(), and CompletionProvider::resolveModuleCompletionsFromText().


| void setSearchPaths | ( | const std::vector< std::string > & | paths | ) |
Definition at line 21 of file projectIndex.cpp.
References ProjectIndex::searchPaths.
|
private |
Definition at line 60 of file projectIndex.cpp.
Referenced by ProjectIndex::resolveModule().

|
private |
Definition at line 57 of file projectIndex.h.
Referenced by ProjectIndex::getAllSymbols(), ProjectIndex::getModuleSymbols(), ProjectIndex::indexAndGet(), ProjectIndex::indexModule(), and ProjectIndex::invalidateModule().
|
private |
Definition at line 56 of file projectIndex.h.
Referenced by ProjectIndex::addSearchPath(), ProjectIndex::getSearchPaths(), ProjectIndex::resolveModule(), and ProjectIndex::setSearchPaths().