summaryrefslogtreecommitdiffstats
path: root/source/slang/slang.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-06-13 12:20:35 -0700
committerGitHub <noreply@github.com>2022-06-13 12:20:35 -0700
commitc90c6ab750ab05dd6d337e4f857958b8f3d00153 (patch)
tree569085637c5d3de33d7aaec8ab8c0e84be49bfd0 /source/slang/slang.cpp
parent68d9d87f9385a8c7c29443dcfcbf70434dc889bd (diff)
Language Server improvements. (#2269)
* Language Server improvements. - Improve parser robustness around `attribute_syntax`. - Exclude instance members in a static query. - Coloring accessors - Improved signature help cursor range check. * Add expected test result. * Language server: support configuring predefined macros. * Fix constructor highlighting. * Improving performance by supporting incremental text change notifications. * Fix UTF16 positions and highlighting of constructor calls. * Add completion suggestions for HLSL semantics. * Fix tests. * Fix: don't skip static variables in a static query. * Include literal init expr value in hover text. * Fix scenarios where completion failed to trigger. * Fixing language server protocol field initializations. Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang.cpp')
-rw-r--r--source/slang/slang.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 7602096d4..02b1efedf 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -2611,6 +2611,11 @@ void Linkage::loadParsedModule(
}
}
loadedModulesList.add(loadedModule);
+
+ if (m_moduleCache)
+ {
+ m_moduleCache->storeModule(this, pathInfo.foundPath, loadedModule);
+ }
}
Module* Linkage::loadModule(String const& name)
@@ -2794,6 +2799,19 @@ RefPtr<Module> Linkage::findOrImportModule(
if (mapPathToLoadedModule.TryGetValue(filePathInfo.getMostUniqueIdentity(), loadedModule))
return loadedModule;
+ // Is this module in user provided cache?
+ // (yong): module cache is intended to speed up language server reparsing.
+ // currently it is *not* enabled in language server.
+ if (m_moduleCache)
+ {
+ loadedModule = m_moduleCache->tryLoadModule(this, filePathInfo.foundPath);
+ if (loadedModule)
+ {
+ mapPathToLoadedModule[filePathInfo.getMostUniqueIdentity()] = loadedModule;
+ return loadedModule;
+ }
+ }
+
// Try to load it
ComPtr<ISlangBlob> fileContents;
if(SLANG_FAILED(includeSystem.loadFile(filePathInfo, fileContents)))
@@ -2945,9 +2963,7 @@ static bool _canExportDeclSymbol(ASTNodeType type)
{
switch (type)
{
- case ASTNodeType::ModuleDecl:
case ASTNodeType::EmptyDecl:
- case ASTNodeType::NamespaceDecl:
{
return false;
}