Skip to content

Commit

Permalink
fix: prevent `Request textDocument/documentHighlight failed with mess…
Browse files Browse the repository at this point in the history
…age: Debug Failure. False expression. Code: -32603` error when selecting Javascript code in the embedded `<script>` tag (#5975)

* Visualforce extension - prevent "Request textDocument/documentHighlight failed with message: Debug Failure. False expression. Code: -32603" error when selecting javascript code in the <script> tag embedded in Visualforce page/component (#5279)

* Update packages/salesforcedx-visualforce-language-server/src/modes/javascriptMode.ts

---------

Co-authored-by: Mingxuan Zhang <[email protected]>
  • Loading branch information
AndrewStopchenko-SO and mingxuanzhangsfdx authored Dec 17, 2024
1 parent effb332 commit 1c2f159
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,11 @@ export const getJavascriptMode = (documentRegions: LanguageModelCache<HTMLDocume
findDocumentHighlight: (document: TextDocument, position: Position): DocumentHighlight[] => {
updateCurrentTextDocument(document);
const highlights = jsLanguageService.getDocumentHighlights(FILE_NAME, currentTextDocument.offsetAt(position), [
FILE_NAME,
document.uri
]);

if (highlights.length > 0) {
if (highlights?.length > 0) {
// Only one file to search above so there should only be one result
return highlights[0].highlightSpans.map(entry => {
return {
Expand Down

0 comments on commit 1c2f159

Please sign in to comment.