Fix indexing errors

This commit is contained in:
Aleksey Kladov 2018-07-31 13:41:30 +03:00
parent 9e02e432b5
commit 87b5e14c75
4 changed files with 7 additions and 7 deletions

View file

@ -9,7 +9,7 @@
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
"args": ["--extensionDevelopmentPath=${workspaceRoot}"],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [ "${workspaceRoot}/out/src/**/*.js" ],

View file

@ -12,7 +12,6 @@ let uris = {
export function activate(context: vscode.ExtensionContext) {
let textDocumentContentProvider = new TextDocumentContentProvider()
let dispose = (disposable) => {
context.subscriptions.push(disposable);
}
@ -25,7 +24,6 @@ export function activate(context: vscode.ExtensionContext) {
let emitter = textDocumentContentProvider.eventEmitter
emitter.fire(uris.syntaxTree)
let syntax = activeSyntax()
console.log(syntax.highlight());
setHighlights(vscode.window.activeTextEditor, syntax.highlight())
})
@ -89,7 +87,10 @@ function documentToFile(disposables: vscode.Disposable[], onChange) {
}
function createFile(text: String) {
return new backend.RustFile(text)
console.time("parsing")
let res = new backend.RustFile(text);
console.timeEnd("parsing")
return res
}
vscode.workspace.onDidChangeTextDocument((event: vscode.TextDocumentChangeEvent) => {
@ -159,7 +160,6 @@ function setHighlights(
editor: vscode.TextEditor,
highlihgs: Array<[number, number, string]>
) {
console.log("setHighlight");
let byTag = {}
for (let tag in decorations) {
byTag[tag] = []

View file

@ -69,7 +69,7 @@ fn atom_expr(p: &mut Parser) -> Option<CompletedMarker> {
match p.current() {
L_PAREN => Some(tuple_expr(p)),
_ => {
p.error("expected expression");
p.err_and_bump("expected expression");
None
}
}

View file

@ -109,7 +109,7 @@ impl<R: TreeRoot> SyntaxNode<R> {
let red = self.red();
let parent = self.parent()?;
let next_sibling_idx = red.index_in_parent()? + 1;
if next_sibling_idx == red.n_children() {
if next_sibling_idx == parent.red().n_children() {
return None;
}
Some(SyntaxNode {