Skip to content

Commit 97a5263

Browse files
changed css and height of on_hover_description tooltip (#14)
1 parent eb6bc70 commit 97a5263

File tree

7 files changed

+35
-12
lines changed

7 files changed

+35
-12
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,11 @@ With [Package Control](https://packagecontrol.io/) (**NOT PUBLISHED YET**):
6969

7070
Manually:
7171

72-
1. Download [latest release](https://github.com/pichillilorenzo/JavaScriptEnhancements/releases) and unzip it into your **Packages folder** (go to `Preferences > Browse Packages...` menu item to open this folder)
72+
1. Download [latest release](https://github.com/pichillilorenzo/JavaScriptEnhancements/releases) (**DON'T CLONE THE REPOSITORY!**) and unzip it into your **Packages folder** (go to `Preferences > Browse Packages...` menu item to open this folder)
7373
2. Rename the folder with `JavaScript Enhancements` name (**THIS STEP IS IMPORTANT**).
7474

75+
If all is going in the right way, you will see `JavaScript Enhancements - installing npm dependencies...` and, after a while, `JavaScript Enhancements - npm dependencies installed correctly.` messages in the status bar of Sublime Text 3. Now the plugin is ready!
76+
7577
### Fixing node.js and npm custom path
7678

7779
If the plugin gives to you message errors like `Error during installation: "node.js" seems not installed on your system...` but instead you have installed node.js and npm (for example using [nvm](https://github.com/creationix/nvm)), then you could try to set your custom path in the [Global settings](https://github.com/pichillilorenzo/JavaScriptEnhancements/wiki/Global-settings) of the plugin and then restart Sublime Text.

_generated_2018_01_14_at_17_26_33.py renamed to _generated_2018_01_16_at_20_17_34.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from shutil import copyfile
44
from threading import Timer
55

6-
PLUGIN_VERSION = "0.13.1"
6+
PLUGIN_VERSION = "0.13.2"
77

88
PACKAGE_PATH = os.path.abspath(os.path.dirname(__file__))
99
PACKAGE_NAME = os.path.basename(PACKAGE_PATH)
@@ -4174,6 +4174,7 @@ def on_hover_description_async(view, point, hover_zone, popup_position, show_hin
41744174
)
41754175

41764176
html = ""
4177+
results_found = 0
41774178

41784179
if result[0]:
41794180
descriptions = result[1]["result"] + load_default_autocomplete(view, result[1]["result"], word, region.begin(), True)
@@ -4185,6 +4186,8 @@ def on_hover_description_async(view, point, hover_zone, popup_position, show_hin
41854186
sub_completions = description['type'].split("&")
41864187
for sub_comp in sub_completions :
41874188

4189+
results_found += 1
4190+
41884191
sub_comp = sub_comp.strip()
41894192
sub_type = sub_comp[1:-1] if description['type'].startswith("((") else sub_comp
41904193

@@ -4251,6 +4254,9 @@ def on_hover_description_async(view, point, hover_zone, popup_position, show_hin
42514254
)
42524255

42534256
if result[0] and result[1].get("type") and result[1]["type"] != "(unknown)":
4257+
4258+
results_found = 1
4259+
42544260
description = dict()
42554261
description["name"] = ""
42564262
description['func_details'] = dict()
@@ -4312,12 +4318,12 @@ def on_hover_description_async(view, point, hover_zone, popup_position, show_hin
43124318

43134319
if html:
43144320
view.show_popup("""
4315-
<html><head></head><body>
4321+
<html><head></head><body class=\""""+("single-result-found" if results_found == 1 else "more-results-found")+"""\">
43164322
"""+js_css+"""
43174323
<div class=\"container-hint-popup\">
43184324
""" + html + """
43194325
</div>
4320-
</body></html>""", sublime.COOPERATE_WITH_AUTO_COMPLETE | sublime.HIDE_ON_MOUSE_MOVE_AWAY, popup_position, 1150, 80, func_action )
4326+
</body></html>""", sublime.COOPERATE_WITH_AUTO_COMPLETE | sublime.HIDE_ON_MOUSE_MOVE_AWAY, popup_position, 1150, 80 if results_found == 1 else 160, func_action )
43214327

43224328

43234329
import sublime, sublime_plugin
@@ -5890,7 +5896,7 @@ def start():
58905896

58915897
try:
58925898
sys.modules["JavaScript Completions"]
5893-
sublime.error_message("Please uninstall/disable JavaScript Completions plugin.")
5899+
sublime.error_message("Please uninstall/disable my other plugin \"JavaScript Completions\". It could conflict with this one!")
58945900
return
58955901
except Exception as err:
58965902
pass

helper/can_i_use/can_i_use_data.json

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

helper/javascript_completions/on_hover_description_event_listener.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ def on_hover_description_async(view, point, hover_zone, popup_position, show_hin
122122
)
123123

124124
html = ""
125+
results_found = 0
125126

126127
if result[0]:
127128
descriptions = result[1]["result"] + load_default_autocomplete(view, result[1]["result"], word, region.begin(), True)
@@ -133,6 +134,8 @@ def on_hover_description_async(view, point, hover_zone, popup_position, show_hin
133134
sub_completions = description['type'].split("&")
134135
for sub_comp in sub_completions :
135136

137+
results_found += 1
138+
136139
sub_comp = sub_comp.strip()
137140
sub_type = sub_comp[1:-1] if description['type'].startswith("((") else sub_comp
138141

@@ -199,6 +202,9 @@ def on_hover_description_async(view, point, hover_zone, popup_position, show_hin
199202
)
200203

201204
if result[0] and result[1].get("type") and result[1]["type"] != "(unknown)":
205+
206+
results_found = 1
207+
202208
description = dict()
203209
description["name"] = ""
204210
description['func_details'] = dict()
@@ -260,10 +266,10 @@ def on_hover_description_async(view, point, hover_zone, popup_position, show_hin
260266

261267
if html:
262268
view.show_popup("""
263-
<html><head></head><body>
269+
<html><head></head><body class=\""""+("single-result-found" if results_found == 1 else "more-results-found")+"""\">
264270
"""+js_css+"""
265271
<div class=\"container-hint-popup\">
266272
""" + html + """
267273
</div>
268-
</body></html>""", sublime.COOPERATE_WITH_AUTO_COMPLETE | sublime.HIDE_ON_MOUSE_MOVE_AWAY, popup_position, 1150, 80, func_action )
274+
</body></html>""", sublime.COOPERATE_WITH_AUTO_COMPLETE | sublime.HIDE_ON_MOUSE_MOVE_AWAY, popup_position, 1150, 80 if results_found == 1 else 160, func_action )
269275

helper/javascript_completions/style.css

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ body{
77
margin: 0;
88
padding: 0;
99
font-size: 0.9rem;
10+
}
11+
body.single-result-found{
12+
13+
}
14+
body.more-results-found{
15+
1016
}
1117
.container{
1218
background-color: #202A31;
@@ -44,9 +50,12 @@ body{
4450
font-style: normal;
4551
color: #fff;
4652
}
47-
.container-hint-popup .container-description{
53+
body.single-result-found .container-hint-popup .container-description{
4854
margin-bottom: 5px;
4955
}
56+
body.more-results-found .container-hint-popup .container-description{
57+
margin-bottom: 10px;
58+
}
5059
.container-hint-popup .container-info{
5160
display: inline;
5261
position: relative;

make/_init.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from shutil import copyfile
44
from threading import Timer
55

6-
PLUGIN_VERSION = "0.13.1"
6+
PLUGIN_VERSION = "0.13.2"
77

88
PACKAGE_PATH = os.path.abspath(os.path.dirname(__file__))
99
PACKAGE_NAME = os.path.basename(PACKAGE_PATH)
@@ -142,7 +142,7 @@ def start():
142142

143143
try:
144144
sys.modules["JavaScript Completions"]
145-
sublime.error_message("Please uninstall/disable JavaScript Completions plugin.")
145+
sublime.error_message("Please uninstall/disable my other plugin \"JavaScript Completions\". It could conflict with this one!")
146146
return
147147
except Exception as err:
148148
pass
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[{"id": "tools", "children": [{"id": "npm_scripts", "children": [], "caption": "Npm/Yarn Scripts"}], "caption": "Tools"}]
1+
[{"caption": "Tools", "children": [{"caption": "Npm/Yarn Scripts", "children": [], "id": "npm_scripts"}], "id": "tools"}]

0 commit comments

Comments
 (0)