Skip to content

Commit

Permalink
maint: Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
famoser committed Nov 17, 2024
1 parent 9899db8 commit b751969
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions server/src/completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ export const getCompletion = async (identifier: TextDocumentIdentifier, position
return undefined;
}

const tokensCount = contextTokens.length
const tokensCount = contextTokens.length;
if (contextTokens.length > 0 && contextTokens[tokensCount-1].type === ProverifParser.SET) {
return Object.getOwnPropertyNames(setRules).map(label => ({ label, kind: CompletionItemKind.Keyword}))
return Object.getOwnPropertyNames(setRules).map(label => ({ label, kind: CompletionItemKind.Keyword}));
}

if (contextTokens.length > 2 && contextTokens[tokensCount-3].type === ProverifParser.SET && contextTokens[tokensCount-1].type === ProverifParser.EQUAL) {
const ruleName = contextTokens[tokensCount-2].text
const ruleName = contextTokens[tokensCount-2].text;
if (ruleName && ruleName in setRules) {
return setRules[ruleName].map(label => ({ label, kind: CompletionItemKind.Value }))
return setRules[ruleName].map(label => ({ label, kind: CompletionItemKind.Value }));
}
}

Expand Down Expand Up @@ -112,12 +112,12 @@ const setRules: { [key in string]: string[] } = {
verboseRedundant: ["false", "true"],
verboseCompleted: ["false", "true"],
verboseGoalReachable: ["true", "false"],
}
};

const createCompletionItem = (text: string): CompletionItem => {
return {
label: text,
kind:CompletionItemKind.Keyword
}
}
};
};

4 changes: 2 additions & 2 deletions server/src/parseTree/get_content_token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ export const getPreviousContextTokens = (tokens: TokenStream, position: Position

const contextTokens: Token[] = [];
for (let i = currentContextTokenIndex; i >= 0 && contextTokens.length < max; i--) {
const candidate = tokens.get(i)
const candidate = tokens.get(i);

// ignore whitespace and last token
if (candidate.type !== ProverifParser.WS && candidate.type !== -1) {
contextTokens.unshift(candidate)
contextTokens.unshift(candidate);
}
}

Expand Down
2 changes: 1 addition & 1 deletion server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ connection.onCompletion(async params => {
}

return completions;
})
});

connection.languages.semanticTokens.on(async params => {
const parseResult = await documentManager.getParseResult(params.textDocument);
Expand Down
6 changes: 3 additions & 3 deletions server/src/tasks/invoke_proverif.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const getProverifBinaryMeta = async (proverifBinary: string): Promise<ProverifBi
KNOWN_PROVERIF_BINARIES[proverifBinary] = {
exists: !error || error.code !== 127,
support_parse_only: !error
}
};

resolve(KNOWN_PROVERIF_BINARIES[proverifBinary]);
});
Expand All @@ -187,8 +187,8 @@ export const invokeProverif = async (documentIdentifier: TextDocumentIdentifier,

const proverifBinaryMeta = await getProverifBinaryMeta(proverifBinary);
if (!proverifBinaryMeta.exists) {
const errorMessage = createSingleErrorMessage(`Failed to invoke ProVerif: ${proverifBinary}`)
return Promise.resolve({proverifBinary, ...errorMessage})
const errorMessage = createSingleErrorMessage(`Failed to invoke ProVerif: ${proverifBinary}`);
return Promise.resolve({proverifBinary, ...errorMessage});
}

// sync changes here into the proverif build task in the client
Expand Down

0 comments on commit b751969

Please sign in to comment.