Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
protected parentContains(candidate: DocumentSymbol | Range, parent: DocumentSymbol | Range, rangeBased: boolean): boolean {
// TODO: move this code to the `monaco-languageclient`: https://github.com/theia-ide/theia/pull/2885#discussion_r217800446
const candidateRange = Range.is(candidate) ? candidate : this.getFullRange(candidate);
const parentRange = Range.is(parent) ? parent : this.getFullRange(parent);
const sameStartLine = candidateRange.start.line === parentRange.start.line;
const startColGreaterOrEqual = candidateRange.start.character >= parentRange.start.character;
const startLineGreater = candidateRange.start.line > parentRange.start.line;
const sameEndLine = candidateRange.end.line === parentRange.end.line;
const endColSmallerOrEqual = candidateRange.end.character <= parentRange.end.character;
const endLineSmaller = candidateRange.end.line < parentRange.end.line;
return (((sameStartLine && startColGreaterOrEqual || startLineGreater) &&
(sameEndLine && endColSmallerOrEqual || endLineSmaller)) || !rangeBased);
}
protected parentContains(candidate: DocumentSymbol | Range, parent: DocumentSymbol | Range, rangeBased: boolean): boolean {
// TODO: move this code to the `monaco-languageclient`: https://github.com/theia-ide/theia/pull/2885#discussion_r217800446
const candidateRange = Range.is(candidate) ? candidate : this.getFullRange(candidate);
const parentRange = Range.is(parent) ? parent : this.getFullRange(parent);
const sameStartLine = candidateRange.start.line === parentRange.start.line;
const startColGreaterOrEqual = candidateRange.start.character >= parentRange.start.character;
const startLineGreater = candidateRange.start.line > parentRange.start.line;
const sameEndLine = candidateRange.end.line === parentRange.end.line;
const endColSmallerOrEqual = candidateRange.end.character <= parentRange.end.character;
const endLineSmaller = candidateRange.end.line < parentRange.end.line;
return (((sameStartLine && startColGreaterOrEqual || startLineGreater) &&
(sameEndLine && endColSmallerOrEqual || endLineSmaller)) || !rangeBased);
}