Skip to content

Commit 44a6972

Browse files
working on #41, fix #42, updated flow-bin to 0.69.0, improved unused variable feature #24, added patreon donate link
1 parent e38c23f commit 44a6972

File tree

12 files changed

+190
-17
lines changed

12 files changed

+190
-17
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ We welcome any type of contribution, not only code. You can help with
88
- **QA**: file bug reports, the more details you can give the better (e.g. screenshots with the console open)
99
- **Marketing**: writing blog posts, howto's, videos, ...
1010
- **Code**: take a look at the [open issues](https://github.com/pichillilorenzo/JavaScriptEnhancements/issues). Even if you can't write code, commenting on them, showing that you care about a given issue matters. It helps us triage them.
11-
- **Money**: we welcome financial contributions in full transparency on [Open Collective](https://opencollective.com/javascriptenhancements) or using [PayPal](https://www.paypal.me/LorenzoPichilli).
11+
- **Money**: we welcome financial contributions in full transparency on [Open Collective](https://opencollective.com/javascriptenhancements), [Patreon](https://www.patreon.com/bePatron?u=9269604) or using [PayPal](https://www.paypal.me/LorenzoPichilli).
1212

1313
## Your First Contribution
1414

@@ -36,9 +36,10 @@ For feature requests/enhancement, create an issue or use [![Gitter](https://img.
3636

3737
## Financial contributions
3838

39-
If this project help you reduce time to develop and also you like it, please support it with a donation on [Open Collective](https://opencollective.com/javascriptenhancements) or using [PayPal](https://www.paypal.me/LorenzoPichilli) 😄👍. Thanks!
39+
If this project helps you reduce time to develop and also you like it, please support it with a donation on [Patreon](https://www.patreon.com/bePatron?u=9269604), [Open Collective](https://opencollective.com/javascriptenhancements) or using [PayPal](https://www.paypal.me/LorenzoPichilli) 😄👍. Thanks!
4040

4141
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.me/LorenzoPichilli)
42+
[![Become a Patron](https://img.shields.io/badge/-Becoma%20a%20Patron!-red.svg?style=for-the-badge)](https://www.patreon.com/bePatron?u=9269604)
4243
<a href="https://opencollective.com/javascriptenhancements/donate" target="_blank">
4344
<img alt="opencollective" src="https://opencollective.com/javascriptenhancements/donate/[email protected]?color=blue" width=300 />
4445
</a>

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](/LICENSE.txt)
99

1010
[![Donate to this project using Paypal](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.me/LorenzoPichilli)
11+
[![Donate to this project using Patreon](https://img.shields.io/badge/patreon-donate-yellow.svg)](https://www.patreon.com/bePatron?u=9269604)
1112
[![Donate to this project using Open Collective](https://img.shields.io/badge/open%20collective-donate-yellow.svg)](https://opencollective.com/javascriptenhancements/donate) [![Backers on Open Collective](https://opencollective.com/javascriptenhancements/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/javascriptenhancements/sponsors/badge.svg)](#sponsors)
1213

1314
**JavaScript Enhancements** is a plugin for **Sublime Text 3**.
@@ -51,7 +52,7 @@ If you want use this plugin, you may want **uninstall/disable** the **JavaScript
5152
In order to work properly, this plugin has some dependencies:
5253

5354
- **Sublime Text 3** (build **3124** or newer)
54-
- **Node.js** (6 or upper) and **npm** ([nodejs.org](https://nodejs.org) or [nvm](https://github.com/creationix/nvm))
55+
- **Node.js** (6 or newer) and **npm** ([nodejs.org](https://nodejs.org) or [nvm](https://github.com/creationix/nvm))
5556
- **TerminalView** (only for _Linux_ and _Mac OS X_) sublime text plugin ([TerminalView](https://github.com/Wramberg/TerminalView))
5657

5758
**Not required**, but **useful** for typescript files (Flow wont work on this type of files):
@@ -137,9 +138,10 @@ For feature requests/enhancement, create an issue or use [![Gitter](https://img.
137138

138139
### Financial contributions
139140

140-
If this project help you reduce time to develop and also you like it, please support it with a donation on [Open Collective](https://opencollective.com/javascriptenhancements) or using [PayPal](https://www.paypal.me/LorenzoPichilli) 😄👍. Thanks!
141+
If this project helps you reduce time to develop and also you like it, please support it with a donation on [Patreon](https://www.patreon.com/bePatron?u=9269604), [Open Collective](https://opencollective.com/javascriptenhancements/donate) or using [PayPal](https://www.paypal.me/LorenzoPichilli) 😄👍. Thanks!
141142

142143
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.me/LorenzoPichilli)
144+
[![Become a Patron](https://img.shields.io/badge/-Becoma%20a%20Patron!-red.svg?style=for-the-badge)](https://www.patreon.com/bePatron?u=9269604)
143145
<a href="https://opencollective.com/javascriptenhancements/donate" target="_blank">
144146
<img alt="opencollective" src="https://opencollective.com/javascriptenhancements/donate/[email protected]?color=blue" width=300 />
145147
</a>

changelog/0.16.12.txt

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
v0.16.12
2+
3+
## Fixes
4+
5+
- Trying to fix #41
6+
- Fixed "Plugin not honouring ST3 user settings - show_definitions" #42
7+
8+
## Improvements
9+
10+
- Updated flow-bin to 0.69.0
11+
- Improved unused variable feature
12+
13+
14+
v0.16.11
15+
16+
## Fixes
17+
18+
- Trying to fix #41
19+
20+
## Improvements
21+
22+
- Updated flow-bin to 0.68.0
23+
24+
25+
v0.16.1
26+
27+
## Fixes
28+
29+
- Fixed NameError: global name 'subprocess' is not defined on /src/libs/terminal.py - Windows OS
30+
- Fixed NoneType error on self.completions.append(completion) in /src/listeners/completion.py
31+
32+
33+
v0.16.0
34+
35+
## Fixes
36+
37+
- Fixed jsdoc generate command
38+
- Fixed error on refactor safe commands when the file name is empty
39+
- Fixed export refactor feature preview
40+
- Fixed some popup colors with different theme color scheme
41+
- Fixed completions and hover_description that starts with "$"
42+
- Fixed issue #36, keymap of next flow error feature changed from "super+alt+c" to "super+alt+b"
43+
44+
## Improvements
45+
46+
- Complete code plugin refactoring
47+
- Improved completions performance using 'flow ide' command
48+
- Added "code screenshot" feature using [carbon](https://carbon.now.sh/)
49+
- updated flow-bin to 0.67.1
50+
- Added initial support for Vue.js (see https://github.com/pichillilorenzo/JavaScriptEnhancements/wiki/Example-Vue.js-project)
51+
- Improved extract method feature
52+
- Improved completions detection from default_autocomplete.json
53+
- Added Flow warnings
54+
- Improved unused variable feature
55+
56+
## Misc
57+
- Changed gutter color (using other available sublime scopes) for errors and unused variable features.
58+
59+
=================================================================
60+
** THIS PLUGIN IS IN BETA! Thanks for your support in advance! **
61+
=================================================================
62+
63+
If you like it, remember to star it ⭐ on GitHub: https://github.com/pichillilorenzo/JavaScriptEnhancements
64+
65+
** USAGE **
66+
===========
67+
68+
See how it works on the Wiki: 👉👉 https://github.com/pichillilorenzo/JavaScriptEnhancements/wiki 👈👈
69+
70+
71+
** WHAT IS THIS? **
72+
===================
73+
74+
This plugin uses Flow (javascript static type checker from Facebook) under the hood.
75+
76+
It offers better javascript autocomplete and a lot of features about creating,
77+
developing and managing javascript projects, such as:
78+
79+
- Cordova projects (run cordova emulate, build, compile, serve, etc. directly from Sublime Text!)
80+
- Ionic v1 and v2 (it includes also v3) projects (same as Cordova projects!)
81+
- Angular v1 and v2 (it includes also v4 and v5) projects
82+
- Vue projects (only about the creation at this moment, see https://github.com/pichillilorenzo/JavaScriptEnhancements/wiki/Example-Vue.js-project)
83+
- React projects (only about the creation at this moment)
84+
- React Native projects (only about the creation at this moment. I will add also NativeScript support)
85+
- Express projects (only about the creation at this moment)
86+
- Yeoman generators
87+
- Local bookmarks project
88+
- JavaScript real-time errors
89+
- Code Refactoring
90+
- etc.
91+
92+
You could use it also in existing projects (see the Wiki - https://github.com/pichillilorenzo/JavaScriptEnhancements/wiki/Using-it-with-an-existing-project)!
93+
94+
It turns Sublime Text into a JavaScript IDE like!
95+
96+
This project is based on my other Sublime Text plugin JavaScript Completions (https://github.com/pichillilorenzo/JavaScript-Completions)
97+
98+
** NOTE **
99+
If you want use this plugin, you may want uninstall/disable the JavaScript Completions plugin, if installed.
100+
101+
** OS SUPPORTED **
102+
==================
103+
104+
👉 Linux (64-bit)
105+
👉 Mac OS X
106+
👉 Windows (64-bit): released without the use of TerminalView plugin. For each feature (like also creating a project) will be used the cmd.exe shell (so during the creation of a project don't close it until it finishes!). Unfortunately the TerminalView plugin supports only Linux-based OS 😞. Has someone any advice or idea about that? Is there something similar to the TerminalView plugin for Windows?? Thanks!
107+
108+
❗❗ Dependencies ❗❗
109+
=======================
110+
111+
In order to work properly, this plugin has some dependencies:
112+
113+
👉 Sublime Text 3 (build 3124 or newer)
114+
👉 Node.js and npm (https://nodejs.org or nvm (https://github.com/creationix/nvm))
115+
👉 TerminalView (only for Linux and Mac OS X) sublime text plugin (https://github.com/Wramberg/TerminalView)
116+
117+
Not required, but useful for typescript files (Flow wont work on this type of files):
118+
119+
👉 TypeScript sublime text plugin (https://github.com/Microsoft/TypeScript-Sublime-Plugin)
120+
121+
** Flow Requirements **
122+
=======================
123+
124+
It use [Flow](https://github.com/facebook/flow) for type checking and auto-completions.
125+
126+
👉 Mac OS X
127+
👉 Linux (64-bit)
128+
👉 Windows (64-bit)
129+
130+
Email me for any questions or doubts about this new project on: [email protected]
131+
132+
** Donation **
133+
==============
134+
135+
If this project help you reduce time to develop and also you like it, please support it with a donation 😄👍. Thanks!
136+
137+
Open Collective: https://opencollective.com/javascriptenhancements/donate
138+
PayPal: https://www.paypal.me/LorenzoPichilli
139+
140+
Thanks anyway for your support! 😄😄
141+
142+
MIT License

main.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,15 @@ def start():
4343
print("node.js version: " + str(node.getCurrentNodeJSVersion()))
4444
except Exception as err:
4545
print(err)
46-
response = sublime.yes_no_cancel_dialog("Error during installation: \"node.js\" seems not installed on your system. Node.js and npm are required to be able to use JavaScript Enhancements plugin.\n\nIf you are using \"nvm\" or you have a different path for node.js and npm, please then change the path on:\n\nPreferences > Package Settings > JavaScript Enhancements > Settings\n\nand restart Sublime Text. If you don't know the path of it, use \"which node\" (for Linux-based OS) or \"where node.exe\" (for Windows OS) to get it.\n\nIf this doesn't work then try also to add the path of their binaries in the PATH key-value on the same JavaScript Enhancements settings file. This variable will be used to add them in the $PATH environment variable, so put the symbol \":\" (instead \";\" for Windows) in front of your path.\n\nDo you want open the website of node.js?", "Yes, open it", "Or use nvm")
46+
response = sublime.yes_no_cancel_dialog("Error during installation: \"node.js\" seems not installed on your system. Node.js (6 or upper) and npm are required to be able to use JavaScript Enhancements plugin.\n\nIf you are using \"nvm\" or you have a different path for node.js and npm, please then change the path on:\n\nPreferences > Package Settings > JavaScript Enhancements > Settings\n\nand restart Sublime Text. If you don't know the path of it, use \"which node\" (for Linux-based OS) or \"where node.exe\" (for Windows OS) to get it.\n\nIf this doesn't work then try also to add the path of their binaries in the PATH key-value on the same JavaScript Enhancements settings file. This variable will be used to add them in the $PATH environment variable, so put the symbol \":\" (instead \";\" for Windows) in front of your path.\n\nDo you want open the website of node.js?", "Yes, open it", "Or use nvm")
47+
if response == sublime.DIALOG_YES:
48+
sublime.active_window().run_command("open_url", args={"url": "https://nodejs.org"})
49+
elif response == sublime.DIALOG_NO:
50+
sublime.active_window().run_command("open_url", args={"url": "https://github.com/creationix/nvm"})
51+
return
52+
53+
if int(str(node.getCurrentNodeJSVersion()).strip().replace('v', '').split('.')[0]) < 6:
54+
response = sublime.yes_no_cancel_dialog("JavaScript Enhancement Error\n\nNode.js version required: 6 or newer.\nYour version is: " + str(node.getCurrentNodeJSVersion()) + "\n\nDo you want open the website of node.js?", "Yes, open it", "Or use nvm")
4755
if response == sublime.DIALOG_YES:
4856
sublime.active_window().run_command("open_url", args={"url": "https://nodejs.org"})
4957
elif response == sublime.DIALOG_NO:
@@ -55,7 +63,7 @@ def start():
5563
print("npm version: " + str(npm.getCurrentNPMVersion()))
5664
except Exception as err:
5765
print(err)
58-
response = sublime.yes_no_cancel_dialog("Error during installation: \"npm\" seems not installed on your system. Node.js and npm are required to be able to use JavaScript Enhancements plugin.\n\nIf you are using \"nvm\" or you have a different path for node.js and npm, please change their custom path on:\n\nPreferences > Package Settings > JavaScript Enhancements > Settings\n\nand restart Sublime Text. If you don't know the path of it, use \"which npm\" (for Linux-based OS) or \"where npm\" (for Windows OS) to get it.\n\nIf this doesn't work then try also to add the path of their binaries in the PATH key-value on the same JavaScript Enhancements settings file. This variable will be used to add them in the $PATH environment variable, so put the symbol \":\" (instead \";\" for Windows) in front of your path.\n\nDo you want open the website of node.js?", "Yes, open it", "Or use nvm")
66+
response = sublime.yes_no_cancel_dialog("Error during installation: \"npm\" seems not installed on your system. Node.js (6 or upper) and npm are required to be able to use JavaScript Enhancements plugin.\n\nIf you are using \"nvm\" or you have a different path for node.js and npm, please change their custom path on:\n\nPreferences > Package Settings > JavaScript Enhancements > Settings\n\nand restart Sublime Text. If you don't know the path of it, use \"which npm\" (for Linux-based OS) or \"where npm\" (for Windows OS) to get it.\n\nIf this doesn't work then try also to add the path of their binaries in the PATH key-value on the same JavaScript Enhancements settings file. This variable will be used to add them in the $PATH environment variable, so put the symbol \":\" (instead \";\" for Windows) in front of your path.\n\nDo you want open the website of node.js?", "Yes, open it", "Or use nvm")
5967
if response == sublime.DIALOG_YES:
6068
sublime.active_window().run_command("open_url", args={"url": "https://nodejs.org"})
6169
elif response == sublime.DIALOG_NO:
@@ -84,7 +92,7 @@ def start():
8492
print(result)
8593
if os.path.exists(node_modules_path):
8694
shutil.rmtree(node_modules_path)
87-
sublime.error_message("Error during installation: can't install npm dependencies for JavaScript Enhancements plugin.\n\nThe error COULD be caused by the npm permission access (EACCES error), so in this case you need to repair/install node.js and npm in a way that doesn't require \"sudo\" command.\n\nFor example you could use a Node Version Manager, such as \"nvm\" or \"nodenv\".\n\nTry to run \"npm install\" inside the package of this plugin to see what you get.\n\nRemember to open an issue on GitHub!")
95+
sublime.error_message("Error during installation: can't install npm dependencies for JavaScript Enhancements plugin.\n\nThe error COULD be caused by the npm permission access (EACCES error), so in this case you need to repair/install node.js (6 or upper) and npm in a way that doesn't require \"sudo\" command.\n\nFor example you could use a Node Version Manager, such as \"nvm\" or \"nodenv\".\n\nTry to run \"npm install\" inside the package of this plugin to see what you get.\n\nRemember to open an issue on GitHub!")
8896
return
8997

9098
Hook.apply('plugin_ready')

messages.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@
2121
"0.15.0": "changelog/0.15.0.txt",
2222
"0.16.0": "changelog/0.16.0.txt",
2323
"0.16.1": "changelog/0.16.1.txt",
24-
"0.16.11": "changelog/0.16.11.txt"
24+
"0.16.11": "changelog/0.16.11.txt",
25+
"0.16.12": "changelog/0.16.12.txt"
2526
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"dependencies": {
3-
"flow-bin": "0.68.0",
3+
"flow-bin": "0.69.0",
44
"flow-remove-types": "1.2.3",
55
"flow-typed": "2.2.3",
66
"jsdoc": "3.5.5"

src/commands/can_i_use/can_i_use_data.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/libs/flow/flow_ide_server.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from ..hook import Hook
44
from .flow_cli import FlowCLI
55
from .main import get_flow_path
6+
from ..node import NodeJS
67

78
flow_ide_clients = {}
89

@@ -24,13 +25,18 @@ def start_stdio_server(self, on_receive, on_closed, options = []):
2425
return
2526

2627
flow_path = get_flow_path()
27-
28+
node_path = []
29+
30+
if sublime.platform() != 'windows':
31+
node = NodeJS()
32+
node_path = [node.node_js_path]
33+
2834
si = None
2935
if os.name == "nt":
3036
si = subprocess.STARTUPINFO() # type: ignore
3137
si.dwFlags |= subprocess.SW_HIDE | subprocess.STARTF_USESHOWWINDOW # type: ignore
3238

33-
args = flow_path + ["ide", "--protocol", "very-unstable", "--from", "sublime_text"] + options + ["--root", self.root]
39+
args = node_path + flow_path + ["ide", "--protocol", "very-unstable", "--from", "sublime_text"] + options + ["--root", self.root]
3440
print("starting flow ide server: " + str(args))
3541
sublime.status_message('Starting flow ide server, root: ' + self.root)
3642

src/libs/global_vars.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22

3-
PLUGIN_VERSION = "0.16.11"
3+
PLUGIN_VERSION = "0.16.12"
44
DEVELOPER_MODE = False
55

66
PACKAGE_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

src/listeners/hover_description.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def on_hover(self, view, point, hover_zone) :
6060
if not view.match_selector(
6161
point,
6262
'source.js - string - constant - comment'
63-
):
63+
) or not view.settings().get("show_definitions"):
6464
return
6565

6666
if hover_zone != sublime.HOVER_TEXT :

0 commit comments

Comments
 (0)