Closed alansouzati closed 8 years ago
I don't know yet how to make that work, but it's clearly a good idea
BTW, I just released v0.6.0 which will try to locate a locally installed version of esformatter if available (so you can have multiple projects each one using a different version of esformatter)
If you have esformatter installed locally on the project folder (maybe listed on your package.json devDependencies
) you should be able to load plugins included on the node_modules
folder.
If possible Id love an example of how to get this to work with esformatter-jsx. For the life of me I cant get it to work from in sublime, cli fine.
Modify the package.json in the esformatter package folder to look like this:
{
"name": "esformatter-generator",
"version": "0.1.0",
"author": "Fabio Crisci <piuccio@gmail.com>",
"description": "Generate the esformatter lib to communicate with sublime",
"scripts": {
"prepublish": "node doStuff.js"
},
"dependencies": {
"browserify": "x",
"mout": "^0.11.0",
"esformatter":"~0.6.0",
"esformatter-jsx": "^1.0.8"
},
"esformatter": {
"plugins": ["esformatter-jsx"]
},
"license": "MIT"
}
Then run npm install is the lib folder. It should work now.
I'm getting the error "Error (1):Unable to format" even after modifying package.json and running npm install.
Furthermore, isn't it rather an antipattern for users to have to edit the package directly before getting it to run properly?
In short: Any movement on this issue?
Totally forgot about this issue, so no movement so far.
Although the real issue is finding time to fix it
I hear you. Wish I could help, but I've never been good in Python.
Managed to get working with @egru instructions :+1: . Here's a Gist with a working config.
I ran into the same issue today. It would be great if sublime-esformatter
did a check if esformatter
is already available (on PATH
or as a globally installed npm module) before falling back to the esformatter version without plugins packaged with sublime-fomatter
.
Since python 3.3 there is shutil.which
that could be used to find executables on path:
>>> import shutil
>>> shutil.which("esformatter")
'/usr/local/bin/esformatter'
(there is also distutils.spawn.find_executable
since python 2.4, see http://stackoverflow.com/a/12611523/893797)
This would also decouple the upgrade cycles and make it possible to use the latest esformatter version even if sublime-esformatter is not updated yet (for whatever reason).
Hi,
Great job on this plugin for Sublime.
I'm trying to use the esformatter-jsx and from the command-line I'm able to get the esformatter to work propertly with JSX files.
I'm wondering if there is a way to load esformatter plugins from your library in Sublime. I see the configuration file, but there is nothing regarding loading plugins.
Kr, Alan