diff options
| author | Yong He <yonghe@outlook.com> | 2022-07-01 15:09:24 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-01 15:09:24 -0700 |
| commit | 0bf899a5f8110fbea97272bdda03b68b91745e51 (patch) | |
| tree | 6e6a0e0210c84e911e563fe3ca6ca4ec4c2dbf4d /source/core/slang-string.cpp | |
| parent | b0ea5ed4da709312910898fa03b4dafc7a27e358 (diff) | |
Language server: auto completion of `import` file and directories. (#2312)
* Language server: auto completion of `import` file and directories.
* Completion of include path.
* Improvements.
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/core/slang-string.cpp')
| -rw-r--r-- | source/core/slang-string.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/source/core/slang-string.cpp b/source/core/slang-string.cpp index 03de07ee1..c02ba048d 100644 --- a/source/core/slang-string.cpp +++ b/source/core/slang-string.cpp @@ -134,7 +134,7 @@ namespace Slang if (otherSize > thisSize) return false; - return UnownedStringSlice(begin(), begin() + otherSize) == other; + return head(otherSize) == other; } bool UnownedStringSlice::startsWith(char const* str) const @@ -142,6 +142,17 @@ namespace Slang return startsWith(UnownedTerminatedStringSlice(str)); } + bool UnownedStringSlice::startsWithCaseInsensitive(UnownedStringSlice const& other) const + { + UInt thisSize = getLength(); + UInt otherSize = other.getLength(); + + if (otherSize > thisSize) + return false; + + return head(otherSize).caseInsensitiveEquals(other); + } + bool UnownedStringSlice::endsWith(UnownedStringSlice const& other) const { @@ -474,6 +485,8 @@ namespace Slang { auto oldLength = getLength(); auto textLength = textEnd - textBegin; + if (textLength <= 0) + return; auto newLength = oldLength + textLength; |
