Skip to content

Commit

Permalink
register vscode extension for nims, nimble (fixes #67)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnetheduck committed Mar 17, 2024
1 parent de5cd48 commit 437118b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion vscode-nph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-nph",
"displayName": "nph - Nim code formatter",
"description": "Opinionated code formatter for Nim",
"version": "0.0.3",
"version": "0.0.4",
"publisher": "arnetheduck",
"engines": {
"vscode": "^1.30.0"
Expand Down
31 changes: 18 additions & 13 deletions vscode-nph/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,25 @@ function getFormattedString(doc: vscode.TextDocument): string {
// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
export function activate(context: vscode.ExtensionContext) {
let disposable = vscode.languages.registerDocumentFormattingEditProvider(
"nim",
{
provideDocumentFormattingEdits(
doc: vscode.TextDocument
): vscode.TextEdit[] {
return [
vscode.TextEdit.replace(rangeWholeFile(doc), getFormattedString(doc))
];
}
let provider = {
provideDocumentFormattingEdits(
doc: vscode.TextDocument
): vscode.TextEdit[] {
return [
vscode.TextEdit.replace(rangeWholeFile(doc), getFormattedString(doc))
];
}
);
context.subscriptions.push(disposable);
};
context.subscriptions.push(vscode.languages.registerDocumentFormattingEditProvider(
"nim", provider
));
context.subscriptions.push(vscode.languages.registerDocumentFormattingEditProvider(
"nims", provider
));
context.subscriptions.push(vscode.languages.registerDocumentFormattingEditProvider(
"nimble", provider
));
}

// this method is called when your extension is deactivated
export function deactivate() {}
export function deactivate() { }

0 comments on commit 437118b

Please sign in to comment.