From a453fadfb373499f08779dd7df8f2347d292fd91 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 8 Jul 2024 19:33:51 -0700 Subject: Language server performance and document symbol fix. (#4561) --- source/slang/slang.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'source/slang/slang.cpp') diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index 67492d9b2..adfa031f5 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -3669,8 +3669,14 @@ RefPtr Linkage::findOrImportModule( // Look for a precompiled module first, if not exist, load from source. - for (int checkBinaryModule = 1; checkBinaryModule >= 0; checkBinaryModule--) + bool shouldCheckBinaryModuleSettings[2] = { true, false }; + + for (auto checkBinaryModule : shouldCheckBinaryModuleSettings) { + // When in language server, we always prefer to use source module if it is available. + if (isInLanguageServer()) + checkBinaryModule = !checkBinaryModule; + // Try without translating `_` to `-` first, if that fails, try translating. for (int translateUnderScore = 0; translateUnderScore <= 1; translateUnderScore++) { -- cgit v1.2.3