summaryrefslogtreecommitdiffstats
path: root/source/slang/slang.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2025-07-03 15:20:23 -0700
committerGitHub <noreply@github.com>2025-07-03 22:20:23 +0000
commitb4fc380af5e390ca11892f9e657e653f6869c21b (patch)
tree9072841ed14a190cce0790ced27b283f85d1fc4f /source/slang/slang.cpp
parent551d0c365571a2e36505851f6a713464662c5fea (diff)
Language Server Enhancements (#7604)
* Language Server: auto-select the best candidate in signature help. * Fix constructor call highlighting + goto definition. * Add test. * format code * Improve ctor signature help. * Add tests. * Fix decl path printing for extension children. * Allow goto definition to show core module source. * c++ compile fix. --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to 'source/slang/slang.cpp')
-rw-r--r--source/slang/slang.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 297a3464f..9bfc2bce9 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -435,6 +435,21 @@ SlangResult Session::compileCoreModule(slang::CompileCoreModuleFlags compileFlag
return compileBuiltinModule(slang::BuiltinModuleName::Core, compileFlags);
}
+void Session::getBuiltinModuleSource(StringBuilder& sb, slang::BuiltinModuleName moduleName)
+{
+ switch (moduleName)
+ {
+ case slang::BuiltinModuleName::Core:
+ sb << (const char*)getCoreLibraryCode()->getBufferPointer()
+ << (const char*)getHLSLLibraryCode()->getBufferPointer()
+ << (const char*)getAutodiffLibraryCode()->getBufferPointer();
+ break;
+ case slang::BuiltinModuleName::GLSL:
+ sb << (const char*)getGLSLLibraryCode()->getBufferPointer();
+ break;
+ }
+}
+
SlangResult Session::compileBuiltinModule(
slang::BuiltinModuleName moduleName,
slang::CompileCoreModuleFlags compileFlags)
@@ -460,17 +475,7 @@ SlangResult Session::compileBuiltinModule(
}
StringBuilder moduleSrcBuilder;
- switch (moduleName)
- {
- case slang::BuiltinModuleName::Core:
- moduleSrcBuilder << (const char*)getCoreLibraryCode()->getBufferPointer()
- << (const char*)getHLSLLibraryCode()->getBufferPointer()
- << (const char*)getAutodiffLibraryCode()->getBufferPointer();
- break;
- case slang::BuiltinModuleName::GLSL:
- moduleSrcBuilder << (const char*)getGLSLLibraryCode()->getBufferPointer();
- break;
- }
+ getBuiltinModuleSource(moduleSrcBuilder, moduleName);
// TODO(JS): Could make this return a SlangResult as opposed to exception
auto moduleSrcBlob = StringBlob::moveCreate(moduleSrcBuilder.produceString());