Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VSCode plugin #408

Closed
dabbott opened this issue Jun 2, 2017 · 7 comments
Closed

VSCode plugin #408

dabbott opened this issue Jun 2, 2017 · 7 comments

Comments

@dabbott
Copy link
Collaborator

dabbott commented Jun 2, 2017

I'm going to write a VSCode plugin for import-js, unless someone else has already written one.

After talking with @lencioni, it sounds like there are two approaches: import the import-js package directly as a dependency (like the Atom plugin), or have the user install via npm i -g import-js and integrate with the CLI (like the Sublime plugin). I tend to prefer the Atom plugin, since it's simpler for the user, so I'm planning to base the VSCode plugin off the Atom plugin.

@dabbott
Copy link
Collaborator Author

dabbott commented Jun 2, 2017

After some investigation, VSCode doesn't seem to support native modules, so I'll probably integrate with the CLI.

@trotzig
Copy link
Collaborator

trotzig commented Jun 3, 2017

By native modules, are you in this case talking about sqlite3 (basically, this issue)? I have had others report issues with this dependency as well. See e.g. Galooshi/atom-import-js#18

I've been trying to find a good-enough alternative that doesn't require native builds (and with that easier to install). If you know of one, that could be a good place to start, replacing sqlite with something js-only. The ExportsStorage file has all the sqlite interaction, and shouldn't be too hard to refactor. The replacement needs to persist to file, provide some kind of querying support, and be able to handle multiple processes writing/reading to the same file/db.

@dabbott
Copy link
Collaborator Author

dabbott commented Jun 3, 2017

Yup, that's the issue. As far as I can tell, VSCode doesn't actually npm install your modules, so it doesn't have a chance to build or download a sqlite3 binary for electron's current version of node.

I'm not that familiar with persistence libs for node, so I'm not sure if there's something suitable out there. I don't know of any that support multiple processes reading/writing.

But I think integrating against the CLI is a fine place to start, so I'll probably go ahead with that for now. It also has the advantage that there's only one import-js API to maintain (no JS API). What do you think?

@trotzig
Copy link
Collaborator

trotzig commented Jun 3, 2017

Yeah, sounds good. The js api isn't ideal as well, it was sort of hacked together to quickly support the atom plugin

@raaffaaeell
Copy link

Hey there, user from the sqlite3 issue. I got my version of the plugin to work on my computer, but sadly couldnt find a solution for other builds (like a generic script to build against the right target).

I added this script to my package.json

"rebuild-sqlite3-win": "cd node_modules/sqlite3 && npm run prepublish && node-gyp configure --module_name=node_sqlite3 --module_path=../lib/binding/node-v53-win32-ia32 && node-gyp node-gyp rebuild --target=1.6.8 --runtime=electron --arch=ia32 --target_platform=win32 --dist-url=https://atom.io/download/atom-shell --module_name=node_sqlite3 --module_path=../lib/binding/node-v53-win32-ia32"

following advice from this repo https://github.com/bytheway/electron-sqlite3

But yeah, I did not find much else about compiling modules for vscode

@dabbott
Copy link
Collaborator Author

dabbott commented Jun 7, 2017

It's a work in progress, but here's what I have so far:

https://github.com/dabbott/vscode-import-js

You can install it from the VS Code marketplace. Just search "importjs".

I wasn't able to call some of the CLI commands from VS Code (possibly env/path issues?), so instead I based it off the sublime plugin.

@raaffaaeell
Copy link

I was checking your code earlier today and found it interesting (had hope I could borrow some ideas from it haha).

Unfortunally I think this approach wont work for the extension I was working

I was messing around trying to add sqlite support to the vscode-database extension, it's working for me, but as it's now, I don't think it's practical to merge my fork of it.

lencioni added a commit that referenced this issue Jun 14, 2017
And special thanks to @dabbott for creating it!

Closes #408
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants