Closed howardpen9 closed 1 year ago
Hi, thank you for this report. Can you share here some code snippet that I can use for the testing this issue?
yeah i've got the same problem. When selecting the default formater it gives error code:
Request textDocument/formatting failed.
Message: Unhandled method textDocument/formatting
Code: -32601
reproduction sample:
import "@stdlib/deploy";
message Add {
amount: Int as uint32;
}
contract SampleTactContract with Deployable {
owner: Address;
counter: Int as uint32;
init(owner: Address) {
self.owner = owner;
self.counter = 0;
}
fun add(v: Int) {
// Check sender
let ctx: Context = context();
require(ctx.sender == self.owner, "Invalid sender");
// Update counter
self.counter = (self.counter + v);
}
receive(msg: Add) {
self.add(msg.amount);
}
receive("increment") {
self.add(1);
}
get fun counter(): Int {
return self.counter;
}
}
Issue is non existent on version 0.2.5
Hey, i've narrow it down to documentFormattingProvider
. I've removed it as a temp workaround here: https://github.com/tact-lang/tact-vscode/pull/4
There is probably something wrong with this bit:
context.subscriptions.push(
languages.registerDocumentFormattingEditProvider('tact', {
provideDocumentFormattingEdits(document: TextDocument, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]> {
return Promise.resolve(formatDocument(document, context));
},
}));
Something is not right with formatDocument
. I will try to fix that later but this might be enough to get you started.
Fixed on v.1.0.1
I installed the vsix file successfully