Closed tylandercasper closed 11 months ago
looking into it a bit more and it seems like the file references aren't correct. It says "out/package/...." but the files they're referencing are in "work/PACKAGENAME/out/package/..."
oddly enough the deno one fails even though it's a fully qualified path, but if I copy and paste the command line it goes through fine.
I think it is related to file path indeed. I use a mac so it should work on mac and linux users.
Maybe there is a way to generate more agnostic paths
I tried running it on my mac, and it's still not working but with a different issue: With dart 3.0.7 I get this output: output.txt
What version of dart are you using, and is there a recommended location I should put your files in.
Good news: Got it to run in Windows. Turns out Processs.Run just needs to be passed runInShell:true.
There was another issue with invalid characters in path, but I was able to resolve that by converting from File(path) to URL.parse(path).
Here's the patch file: windows.patch
Bad news is I'm still getting the same issues as I was getting on the mac.
If I comment out the @Typings.npm line in core.dart than I have a little bit more success. All of them work except for lib/d/inputmask.dart.
Unfortunately the project I was hoping to convert still doesn't work. Before I dig into why, I'd really like to figure out why even the default setup isn't building for me.
Today is holiday here in Brazil so I will probably be back on monday or maybe tomorrow then I try to help. What is the package you are trying to build?
"@types/vscode" which can be pulled from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/vscode or https://github.com/microsoft/vscode/blob/main/src/vscode-dts/vscode.d.ts
not sure which one is better.
Thanks again for your help
pushed a commit to master with the vscode bindings
@tylandercasper can you do some usage testings before I publish it please.
hey thanks man. I just got off of work, but I'll play with it tomorrow and let you know.
unfortunately it looks like I may have wasted your time. vscode uses node and dart compile js doesn't support outputting modules. before I can even run your code I'm getting compile issues like "self" is undefined and output issues like "import 'package:typings/d/vscode/vscode_commands.dart' as vscode_commands;" creating js like vscode.commands.vscode.commands
even fixing the superficial issues it still breaks when a command is actually run.
[Main Instruction]
Command 'Hello World' resulted in an error
[Content]
NoSuchMethodError: method not found: 'call'
Receiver: Closure '__activateVs_closure'
Arguments: []
If that error means something to you and have an easy fix I'll take it, but otherwise I feel like this is out of scope for your project.
Thanks so much for looking into it for me though. I really appreciate it and I love what you're trying to do here.
I guess I can take a look when I get some free time.
I would need a simple repro of a working JS file and how to test it
Hey if you're looking for a challenge or some kind of extreme edge case to push your tools limits, I can upload a sample for you to play with. BUT I do think there's like a 90% chance that this has nothing to do with your tool and everything to do with the fact that dart js wasn't meant to hybrid environments like vscode.
On the bright side, the latest changes plus the windows patch I included above have fixed the original issue! I can now call build_runner without any issues. So we can safely close this issue.
I think we can overcome these dart2js with something like https://pub.dev/packages/node_preamble.
I am just not sure how to add the js in the lib into the build system
I put up a sample project up at https://github.com/tylandercasper/dart_vsplugin
The readme.md file has step by step instructions on running it.
There's also a wrapper.js if you want to throw in some extra launch logic.
If you can figure out the changes necessary to get it to work at all then it's pretty simple to make a script that modifies the output file to add those changes.
On Tue, Sep 26, 2023 at 5:38 PM Jonathan Rezende @.***> wrote:
I think we can overcome these dart2js with something like https://pub.dev/packages/node_preamble.
I am just not sure how to add the js in the lib into the build system
— Reply to this email directly, view it on GitHub https://github.com/jodinathan/typings/issues/6#issuecomment-1736397901, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGZPNAF5OKKJTRZUVEUPMLX4NKOHANCNFSM6AAAAAA4K36LX4 . You are receiving this because you were mentioned.Message ID: @.***>
found the problem. The vscode extension is calling the callback without arguments, hence why it can't find the call
signature.
Change the call to registerCommand
to make its first argument optional: vscode_commands.registerCommand('dart_vscode.helloWorld', ([a]) {}
then it works
I will dig why it is generating vscode.window.vscode.window
soon.
I will also make the signature of functions with nullable parameters to use optional parameters. I think this change will fix the call
problem because it will be required the callbacks to use optional parameters
wow, that was fast!
One other weird issue is that register command returns a "Disposable", but the subscriptions array is expecting an "IInline32" object, which Disposable does not implement or extend.
On Thu, Sep 28, 2023 at 10:25 AM Jonathan Rezende @.***> wrote:
I will dig why it is generating vscode.window.vscode.window soon.
I will also make the signature of functions with nullable parameters to use optional parameters. I think this change will fix the call problem because it will be required the callbacks to use optional parameters
— Reply to this email directly, view it on GitHub https://github.com/jodinathan/typings/issues/6#issuecomment-1739527007, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGZPNERRXFP4YLGL5ZL5ALX4WJGLANCNFSM6AAAAAA4K36LX4 . You are receiving this because you were mentioned.Message ID: @.***>
publibhsed a new version with fixes:
vscode.window.vscode.window
is fixedsubscriptions
is now a dynamic List
the main.dart
in the example now:
import 'package:typings/d/vscode.dart' as vscode;
import 'package:typings/d/vscode/vscode_commands.dart' as vscode_commands;
import 'package:typings/d/vscode/vscode_window.dart' as vscode_window;
void activate(vscode.ExtensionContext context) {
// Use the console to output diagnostic information (console.log) and errors (console.error)
// This line of code will only be executed once when your extension is activated
print('Congratulations, your extension "dart_vscode" is now active!');
// The command has been defined in the package.json file
// Now provide the implementation of the command with registerCommand
// The commandId parameter must match the command field in package.json
var disposable =
vscode_commands.registerCommand('dart_vscode.helloWorld', ([a]) {
// The code you place here will be executed every time your command is executed
// Display a message box to the user
vscode_window.showInformationMessage.$1('Hello World from dart_vscode!');
});
context.subscriptions.add(disposable);
}
void main() {
vscode.module.exports = vscode.ModuleExports(activate: activate);
}
I am closing this issue as this is fixed but please feel free to open a new one if you find anything.
Also, please, consider donating if it is an affordable option to you. Raising a family in Brazil is just way too difficult.
I'm trying to play around with the tool and am having difficulties getting it to do anything.
running the command: dart run --enable-asserts --enable-experiment="inline-class" build_runner build --enable-experiment="inline-class"
generates:
Let me know if there's anything I can change. I'm very excited to see what the updated version of jsbindings can do!