Fix three DeepScan complaints

This commit is contained in:
James-Yu 2023-01-09 10:32:50 +08:00
parent 96b6bcd900
commit 177bf3e186
2 changed files with 10 additions and 17 deletions

View File

@ -191,7 +191,6 @@ export class MathPreviewPanel {
if (!texMath) {
this.clearCache()
return this.panel.webview.postMessage({type: 'mathImage', src: '' })
return
}
let cachedCommands: string | undefined
if ( position.line === this.prevCursorPosition?.line && documentUri === this.prevDocumentUri ) {

View File

@ -202,32 +202,26 @@ export class SelectionRangeProvider implements vscode.SelectionRangeProvider {
itemNodes = itemNodes.filter((node) => node.name === 'item')
newInnerContent = this.findInnerContentIncludingPos(lupos, innerContent, itemNodes, innerContentLuRange)
if (newInnerContent) {
if (newInnerContent.startSep?.location) {
const start = LuPos.from(newInnerContent.startSep.location.start)
innerContent = newInnerContent.content
innerContentLuRange = newInnerContent.contentLuRange
const newContentRange = toVscodeRange({start, end:innerContentLuRange.end})
curSelectionRange = new vscode.SelectionRange(newContentRange, curSelectionRange)
}
innerContent = newInnerContent.content
innerContentLuRange = newInnerContent.contentLuRange
const newContentRange = toVscodeRange(innerContentLuRange)
let newContentRange = toVscodeRange(innerContentLuRange)
if (newInnerContent.startSep?.location) {
const start = LuPos.from(newInnerContent.startSep.location.start)
newContentRange = toVscodeRange({start, end:innerContentLuRange.end})
}
curSelectionRange = new vscode.SelectionRange(newContentRange, curSelectionRange)
}
}
const linebreaksNodes = innerContent.filter(latexParser.isLinebreak)
newInnerContent = this.findInnerContentIncludingPos(lupos, innerContent, linebreaksNodes, innerContentLuRange)
if (newInnerContent) {
if (newInnerContent.endSep?.location) {
const end = LuPos.from(newInnerContent.endSep.location.end)
innerContent = newInnerContent.content
innerContentLuRange = newInnerContent.contentLuRange
const newContentRange = toVscodeRange({start: innerContentLuRange.start, end})
curSelectionRange = new vscode.SelectionRange(newContentRange, curSelectionRange)
}
innerContent = newInnerContent.content
innerContentLuRange = newInnerContent.contentLuRange
const newContentRange = toVscodeRange(innerContentLuRange)
let newContentRange = toVscodeRange(innerContentLuRange)
if (newInnerContent.endSep?.location) {
const end = LuPos.from(newInnerContent.endSep.location.end)
newContentRange = toVscodeRange({start: innerContentLuRange.start, end})
}
curSelectionRange = new vscode.SelectionRange(newContentRange, curSelectionRange)
}
const alignmentTabNodes = innerContent.filter(latexParser.isAlignmentTab)