summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-workspace-version.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-06-16 01:50:43 -0700
committerGitHub <noreply@github.com>2022-06-16 01:50:43 -0700
commit241def9c7619c437aad1bb620be8891e61707d8d (patch)
treed412a108bcd4bc9e52e0d6bf230b16d90df632d2 /source/slang/slang-workspace-version.cpp
parent23f567323e36a14e0649899b5b8811312d7ea9fd (diff)
Language server: document symbols (#2287)
* Language Server: Document Symbol outline. * Fix highlighting of extension decls. 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, 6 insertions, 0 deletions
diff --git a/source/slang/slang-workspace-version.cpp b/source/slang/slang-workspace-version.cpp
index 2742c083c..781d8a3bc 100644
--- a/source/slang/slang-workspace-version.cpp
+++ b/source/slang/slang-workspace-version.cpp
@@ -390,6 +390,12 @@ ArrayView<Index> DocumentVersion::getUTF16Boundaries(Index line)
void DocumentVersion::oneBasedUTF8LocToZeroBasedUTF16Loc(
Index inLine, Index inCol, Index& outLine, Index& outCol)
{
+ if (inLine <= 0)
+ {
+ outLine = 0;
+ outCol = 0;
+ }
+
Index rsLine = inLine - 1;
auto line = lines[rsLine];
auto bounds = getUTF16Boundaries(inLine);