hoshi-lang dev
Yet another programming language
Loading...
Searching...
No Matches
projectIndex.h
Go to the documentation of this file.
1//
2// Project Index — multi-file module resolution and symbol cache
3//
4
5#ifndef HOSHI_LANG_LSP_PROJECT_INDEX_H
6#define HOSHI_LANG_LSP_PROJECT_INDEX_H
7
8#include <map>
9#include <memory>
10#include <string>
11#include <vector>
12#include <share/def.hpp>
14#include "symbolExtractor.h"
15
16namespace lsp {
17
19public:
21
22 void setSearchPaths(const std::vector<std::string> &paths);
23 void addSearchPath(const std::string &path);
24 const std::vector<std::string> &getSearchPaths() const { return searchPaths; }
25
30 std::string resolveModule(const std::string &importPath,
31 const std::string &relativeToFile);
32
35 void indexModule(const std::string &absolutePath);
36
38 const yoi::vec<Symbol> *getModuleSymbols(const std::string &absolutePath);
39
42
44 const yoi::vec<Symbol> &indexAndGet(const std::string &absolutePath);
45
47 void invalidateModule(const std::string &absolutePath);
48
49private:
55
56 std::vector<std::string> searchPaths;
57 std::map<std::string, IndexedModule> modules;
58
59 std::string tryResolve(const std::string &searchDir, const std::string &importPath);
60
61 void parseAndIndex(const std::string &absolutePath, const std::wstring &text,
62 IndexedModule &mod);
63};
64
65} // namespace lsp
66
67#endif // HOSHI_LANG_LSP_PROJECT_INDEX_H
const yoi::vec< Symbol > & indexAndGet(const std::string &absolutePath)
Parse and index a module, then return its symbols.
std::map< std::string, IndexedModule > modules
void invalidateModule(const std::string &absolutePath)
Clear a module from the cache (e.g., when it changes on disk).
const std::vector< std::string > & getSearchPaths() const
const yoi::vec< Symbol > * getModuleSymbols(const std::string &absolutePath)
Get symbols for a specific module.
void indexModule(const std::string &absolutePath)
std::string resolveModule(const std::string &importPath, const std::string &relativeToFile)
void setSearchPaths(const std::vector< std::string > &paths)
void addSearchPath(const std::string &path)
void getAllSymbols(yoi::vec< Symbol > &out)
Collect all symbols from all indexed modules into flat list.
void parseAndIndex(const std::string &absolutePath, const std::wstring &text, IndexedModule &mod)
std::vector< std::string > searchPaths
std::string tryResolve(const std::string &searchDir, const std::string &importPath)
std::vector< t > vec
Definition def.hpp:56
std::wstring wstr
Definition def.hpp:51