summaryrefslogtreecommitdiff
path: root/source/slang/slang-workspace-version.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-workspace-version.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-workspace-version.cpp')
-rw-r--r--source/slang/slang-workspace-version.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/slang/slang-workspace-version.cpp b/source/slang/slang-workspace-version.cpp
index b1a3dec34..63bf7ed53 100644
--- a/source/slang/slang-workspace-version.cpp
+++ b/source/slang/slang-workspace-version.cpp
@@ -487,7 +487,10 @@ void DocumentVersion::oneBasedUTF8LocToZeroBasedUTF16Loc(
Index rsLine = inLine - 1;
auto bounds = getUTF16Boundaries(inLine);
outLine = rsLine;
- outCol = std::lower_bound(bounds.begin(), bounds.end(), inCol - 1) - bounds.begin();
+ if (bounds.getCount() != 0)
+ outCol = std::lower_bound(bounds.begin(), bounds.end(), inCol - 1) - bounds.begin();
+ else
+ outCol = inCol - 1;
}
void DocumentVersion::oneBasedUTF8LocToZeroBasedUTF16Loc(