Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
CSSCompletion.prototype.getCompletionsForSelector = function (ruleSet, isNested, result) {
var _this = this;
var existingNode = this.findInNodePath(nodes.NodeType.PseudoSelector, nodes.NodeType.IdentifierSelector, nodes.NodeType.ClassSelector, nodes.NodeType.ElementNameSelector);
if (!existingNode && this.offset - this.currentWord.length > 0 && this.textDocument.getText()[this.offset - this.currentWord.length - 1] === ':') {
// after the ':' of a pseudo selector, no node generated for just ':'
this.currentWord = ':' + this.currentWord;
this.defaultReplaceRange = vscode_languageserver_types_1.Range.create(vscode_languageserver_types_1.Position.create(this.position.line, this.position.character - this.currentWord.length), this.position);
}
var pseudoClasses = languageFacts.cssDataManager.getPseudoClasses();
pseudoClasses.forEach(function (entry) {
var insertText = moveCursorInsideParenthesis(entry.name);
var item = {
label: entry.name,
textEdit: vscode_languageserver_types_1.TextEdit.replace(_this.getCompletionRange(existingNode), insertText),
documentation: languageFacts.getEntryDescription(entry),
kind: vscode_languageserver_types_1.CompletionItemKind.Function,
insertTextFormat: entry.name !== insertText ? SnippetFormat : void 0
};
if (strings.startsWith(entry.name, ':-')) {
item.sortText = 'x';
}
result.items.push(item);
});
.subscribe((newRange: types.Range) => {
const line0 = newRange.start.line
const line1 = newRange.end.line
const startLine = Math.min(line0, line1)
const endLine = Math.max(line0, line1)
// Clamp range to lines
const adjustedRange = types.Range.create(startLine, 0, endLine + 1, 0)
store.dispatch({
type: "SELECTION_CHANGED",
range: adjustedRange,
})
})
const args = bufferUpdateArgs.context
const lineNumber = bufferUpdateArgs.lineNumber
const changedLine = bufferUpdateArgs.lineContents
const buf = bufferManager.updateBufferFromEvent(args)
// Don't process the update if it is behind the current version
if (args.version < buf.version) {
Log.warn("[Neovim Editor] Skipping incremental update because version is out of date")
return null
}
return {
buffer: buf,
contentChanges: [{
range: types.Range.create(lineNumber - 1, 0, lineNumber, 0),
text: changedLine + os.EOL,
}],
}
})
function getRange(node) {
return vscode_languageserver_types_1.Range.create(document.positionAt(node.offset), document.positionAt(node.end));
}
var offset = document.offsetAt(position);
function getRange(node, document) {
return vscode_languageserver_types_1.Range.create(document.positionAt(node.offset), document.positionAt(node.end));
}
function getHighlightKind(node) {
start = lastIdx + 1;
end = idx;
break;
} else {
lastIdx = idx;
}
}
if (idx === lineText.length - 1) {
start = lineText.lastIndexOf(' ') + 1;
end = idx + 1;
}
}
if (start < 0 || end < 0) {
return;
} else {
range = vscode_languageserver_types_1.Range.create(line, start, line, end);
}
return range;
}
exports.getRangeAtPosition = getRangeAtPosition;
function toDiagnostic(marker) {
var range = vscode_languageserver_types_1.Range.create(document.positionAt(marker.getOffset()), document.positionAt(marker.getOffset() + marker.getLength()));
var source = document.languageId;
return {
code: marker.getRule().id,
source: source,
message: marker.getMessage(),
severity: marker.getLevel() === nodes.Level.Warning ? vscode_languageserver_types_1.DiagnosticSeverity.Warning : vscode_languageserver_types_1.DiagnosticSeverity.Error,
range: range
};
}
return entries.filter(function (entry) { return entry.getLevel() !== nodes.Level.Ignore; }).map(toDiagnostic);
toDiagnostic(attr, document, message, code = undefined, serverity = vscode_languageserver_types_1.DiagnosticSeverity.Error) {
const range = vscode_languageserver_types_1.Range.create(document.positionAt(attr.start), document.positionAt(attr.start + attr.length));
const diagnostic = {
message: message,
range: range,
severity: serverity,
source: exports.DiagnosticSource,
};
if (code !== undefined) {
diagnostic.code = code;
}
return diagnostic;
}
}
return searchServiceTraverser.traverseKubernetesSchema(parentNodes, node, false, function (possibleChildren) {
let possibleChildrenNoDuplicates = arrUtils_1.removeDuplicates(possibleChildren, "description");
let hoverNode = possibleChildrenNoDuplicates[0];
if (hoverNode) {
let startPos = node.startPosition;
let endPos = node.endPosition;
//Use the keys start position when you are hovering over a scalar item
if (node.kind === yaml_ast_parser_1.Kind.SCALAR) {
startPos = node.parent.key.startPosition ? node.parent.key.startPosition : startPos;
}
let hoverRange = vscode_languageserver_types_1.Range.create(document.positionAt(startPos), document.positionAt(endPos));
let hoverItem = {
contents: hoverNode.description,
range: hoverRange
};
return hoverItem;
}
return null;
});
}
import { connect } from "react-redux"
import * as types from "vscode-languageserver-types"
import { Definition, IDefinitionProps } from "./../../../UI/components/Definition"
import * as Selectors from "./../NeovimEditorSelectors"
import * as State from "./../NeovimEditorStore"
const emptyRange = types.Range.create(
types.Position.create(-1, -1),
types.Position.create(-1, -1),
)
const getActiveDefinition = (state: State.IState) => state.definition
const mapStateToProps = (state: State.IState): IDefinitionProps => {
const window = Selectors.getActiveWindow(state)
const noop = (): any => null
const activeDefinition = getActiveDefinition(state)
const range = activeDefinition ? activeDefinition.token.range : emptyRange