mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Fix indexing errors
This commit is contained in:
parent
9e02e432b5
commit
87b5e14c75
4 changed files with 7 additions and 7 deletions
2
code/.vscode/launch.json
vendored
2
code/.vscode/launch.json
vendored
|
@ -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" ],
|
||||
|
|
|
@ -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] = []
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue