-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9cecea
commit b0d24c5
Showing
25 changed files
with
141 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,23 @@ | ||
import { transformLocations } from '@volar/language-service'; | ||
import { getGeneratedPositions, getSourceRange } from '@volar/language-service/lib/utils/featureWorkers'; | ||
import type * as html from 'vscode-html-languageservice'; | ||
import type { PugDocument } from '../pugDocument'; | ||
import { transformLocations } from '@volar/language-service'; | ||
|
||
export function register(htmlLs: html.LanguageService) { | ||
return (pugDoc: PugDocument, pos: html.Position) => { | ||
|
||
const htmlPos = pugDoc.map.getGeneratedPosition(pos); | ||
if (!htmlPos) { | ||
return; | ||
} | ||
for (const htmlPos of getGeneratedPositions(pugDoc.docs, pos)) { | ||
|
||
const htmlResult = htmlLs.findDocumentHighlights( | ||
pugDoc.map.embeddedDocument, | ||
htmlPos, | ||
pugDoc.htmlDocument | ||
); | ||
const htmlResult = htmlLs.findDocumentHighlights( | ||
pugDoc.docs[1], | ||
htmlPos, | ||
pugDoc.htmlDocument | ||
); | ||
|
||
return transformLocations( | ||
htmlResult, | ||
htmlRange => pugDoc.map.getSourceRange(htmlRange) | ||
); | ||
return transformLocations( | ||
htmlResult, | ||
htmlRange => getSourceRange(pugDoc.docs, htmlRange) | ||
); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
import { transformLocations } from '@volar/language-service'; | ||
import { getSourceRange } from '@volar/language-service/lib/utils/featureWorkers'; | ||
import type * as html from 'vscode-html-languageservice'; | ||
import type { PugDocument } from '../pugDocument'; | ||
import { transformLocations } from '@volar/language-service'; | ||
|
||
export function register(htmlLs: html.LanguageService) { | ||
return (pugDoc: PugDocument, docContext: html.DocumentContext) => { | ||
|
||
const htmlResult = htmlLs.findDocumentLinks( | ||
pugDoc.map.embeddedDocument, | ||
pugDoc.docs[1], | ||
docContext | ||
); | ||
|
||
return transformLocations( | ||
htmlResult, | ||
htmlRange => pugDoc.map.getSourceRange(htmlRange) | ||
htmlRange => getSourceRange(pugDoc.docs, htmlRange) | ||
); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,24 @@ | ||
import { transformHover } from '@volar/language-service'; | ||
import { getGeneratedPositions, getSourceRange } from '@volar/language-service/lib/utils/featureWorkers'; | ||
import type * as html from 'vscode-html-languageservice'; | ||
import type { PugDocument } from '../pugDocument'; | ||
import { transformHover } from '@volar/language-service'; | ||
|
||
export function register(htmlLs: html.LanguageService) { | ||
return (pugDoc: PugDocument, pos: html.Position, options?: html.HoverSettings | undefined) => { | ||
|
||
const htmlPos = pugDoc.map.getGeneratedPosition(pos); | ||
if (!htmlPos) { | ||
return; | ||
} | ||
for (const htmlPos of getGeneratedPositions(pugDoc.docs, pos)) { | ||
|
||
const htmlResult = htmlLs.doHover( | ||
pugDoc.map.embeddedDocument, | ||
htmlPos, | ||
pugDoc.htmlDocument, | ||
options | ||
); | ||
if (!htmlResult) { | ||
return; | ||
} | ||
const htmlResult = htmlLs.doHover( | ||
pugDoc.docs[1], | ||
htmlPos, | ||
pugDoc.htmlDocument, | ||
options | ||
); | ||
if (!htmlResult) { | ||
return; | ||
} | ||
|
||
return transformHover(htmlResult, htmlRange => pugDoc.map.getSourceRange(htmlRange)); | ||
return transformHover(htmlResult, htmlRange => getSourceRange(pugDoc.docs, htmlRange)); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,20 @@ | ||
import { getGeneratedPositions } from '@volar/language-service/lib/utils/featureWorkers'; | ||
import type * as html from 'vscode-html-languageservice'; | ||
import type { PugDocument } from '../pugDocument'; | ||
|
||
export function register(htmlLs: html.LanguageService) { | ||
return (pugDoc: PugDocument, pos: html.Position, options?: html.CompletionConfiguration | undefined) => { | ||
|
||
const htmlStart = pugDoc.map.getGeneratedPosition(pos); | ||
if (!htmlStart) { | ||
return; | ||
} | ||
for (const htmlStart of getGeneratedPositions(pugDoc.docs, pos)) { | ||
|
||
const text = htmlLs.doQuoteComplete( | ||
pugDoc.htmlTextDocument, | ||
htmlStart, | ||
pugDoc.htmlDocument, | ||
options | ||
); | ||
const text = htmlLs.doQuoteComplete( | ||
pugDoc.docs[1], | ||
htmlStart, | ||
pugDoc.htmlDocument, | ||
options | ||
); | ||
|
||
return text; | ||
return text; | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,24 @@ | ||
import type * as html from 'vscode-html-languageservice'; | ||
import type { PugDocument } from '../pugDocument'; | ||
import { transformLocations } from '@volar/language-service'; | ||
import { getGeneratedPositions, getSourceRange } from '@volar/language-service/lib/utils/featureWorkers'; | ||
|
||
export function register(htmlLs: html.LanguageService) { | ||
return (pugDoc: PugDocument, posArr: html.Position[]) => { | ||
|
||
const htmlPosArr = posArr | ||
.map(position => pugDoc.map.getGeneratedPosition(position)) | ||
.map(position => { | ||
for (const pos of getGeneratedPositions(pugDoc.docs, position)) { | ||
return pos; | ||
} | ||
}) | ||
.filter((v): v is NonNullable<typeof v> => !!v); | ||
|
||
const htmlResult = htmlLs.getSelectionRanges( | ||
pugDoc.map.embeddedDocument, | ||
pugDoc.docs[1], | ||
htmlPosArr | ||
); | ||
|
||
return transformLocations(htmlResult, htmlRange => pugDoc.map.getSourceRange(htmlRange)); | ||
return transformLocations(htmlResult, htmlRange => getSourceRange(pugDoc.docs, htmlRange)); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.