summaryrefslogtreecommitdiff
path: root/source/slang/slang-workspace-version.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-11-30 14:53:53 -0800
committerGitHub <noreply@github.com>2022-11-30 14:53:53 -0800
commitf51f69d045d9e0b83d9ab1f4623d4319ce1867be (patch)
treea7c9cee36ef168810c8feed64edbe6a593ffb90d /source/slang/slang-workspace-version.cpp
parent976f578585a4d4ed24e37d0c45a94a8e6afcff19 (diff)
Fix missing semantic highlighting in attributes and ExtractExitentialValueExpr. (#2541)
* Fix missing semantic highlighting in attributes and ExtractExitentialValueExpr. * Fix regression on partially specialized generic expr highlighting. * Add regression test. Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-workspace-version.cpp')
-rw-r--r--source/slang/slang-workspace-version.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/slang/slang-workspace-version.cpp b/source/slang/slang-workspace-version.cpp
index d5fc62e79..309d4e51d 100644
--- a/source/slang/slang-workspace-version.cpp
+++ b/source/slang/slang-workspace-version.cpp
@@ -51,7 +51,11 @@ void Workspace::changeDoc(const String& path, LanguageServerProtocol::Range rang
auto endOffset = doc->getOffset(line, col);
auto originalText = doc->getText().getUnownedSlice();
StringBuilder newText;
- newText << originalText.head(startOffset) << text << originalText.tail(endOffset);
+ if (startOffset != -1)
+ newText << originalText.head(startOffset);
+ newText << text;
+ if (endOffset != -1)
+ newText << originalText.tail(endOffset);
changeDoc(doc.Ptr(), newText.ProduceString());
}
}