Skip to content

Commit f75325a

Browse files
timotheecourVarriount
authored andcommitted
fix #130 (#138)
* Move core files to 'core' directory. Remove Nimsuggest and Nimble support. * Refactor settings, hotkeys, and nimcheck code. * Fix #110 * Fix file permissions. * fix #118 (#120) * fix #118 * Update core/commands/nimcheck.py Co-Authored-By: timotheecour <timothee.cour2@gmail.com> * Make command import more correct. * fix #112 (#123) * Split comment grammer into separate file, to support nested multiline comments. Fixes #94 * Update keymaps for new comment definitions. Fixes #94, #97, and #128 * Straighten out TODO matching. * Simplify package settings menu by using native edit_settings command. * Fix comment continuation. * Remove ST2/ST3 distinction. * comment and doc comment completion work (#133) * fix #134 (#135) * fix #125 (#127) * should fix #125 (hopefully) let me know if I'm mistaken * Update Nim.YAML-tmLanguage (#126)
1 parent e63f5bf commit f75325a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1028
-4010
lines changed

Default (Linux).sublime-keymap

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@
2424
[
2525
{ "key": "setting.doccontinue.enabled", "operand": true },
2626
{ "key": "selection_empty", "operand": true },
27-
{ "key": "selector", "operand": "comment.line.number-sign.doc-comment.nim" }
27+
{ "key": "selector", "operand": "comment.line.number-sign.doc-comment.body.nim" }
2828
]
2929
},
3030
{ "keys": ["enter"], "command": "insert_snippet", "args": {"contents": "\n## $0"}, "context":
3131
[
3232
{ "key": "setting.doccontinue.enabled", "operand": true },
3333
{ "key": "setting.doccontinue.autostop", "operand": false },
34-
{ "key": "selector", "operand": "comment.line.number-sign.doc-comment.empty.nim"}
34+
{ "key": "selector", "operand": "comment.line.number-sign.doc-comment.nim" },
35+
{ "key": "selector", "operand": "punctuation.definition.doc-comment.nim", "operator": "not_equal" }
3536
]
3637
},
3738

Default (OSX).sublime-keymap

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,30 @@
2424
[
2525
{ "key": "setting.doccontinue.enabled", "operand": true },
2626
{ "key": "selection_empty", "operand": true },
27-
{ "key": "selector", "operand": "comment.line.number-sign.doc-comment.nim" }
27+
{ "key": "selector", "operand": "comment.line.number-sign.doc-comment.body.nim" }
2828
]
2929
},
3030
{ "keys": ["enter"], "command": "insert_snippet", "args": {"contents": "\n## $0"}, "context":
3131
[
3232
{ "key": "setting.doccontinue.enabled", "operand": true },
3333
{ "key": "setting.doccontinue.autostop", "operand": false },
34-
{ "key": "selector", "operand": "comment.line.number-sign.doc-comment.empty.nim"}
34+
{ "key": "selector", "operand": "comment.line.number-sign.doc-comment.nim" },
35+
{ "key": "selector", "operand": "punctuation.definition.doc-comment.nim", "operator": "not_equal" }
3536
]
3637
},
3738

38-
// Multi-line doc-comment completion
39+
// Multi-line comment completion
3940
{ "keys": ["["], "command": "insert_snippet", "args": {"contents": "[\n$0\n]#"}, "context":
4041
[
4142
{ "key": "selector", "operator":"equal", "operand": "punctuation.definition.comment.nim"}
4243
]
4344
},
45+
// Multi-line doc-comment completion
46+
{ "keys": ["["], "command": "insert_snippet", "args": {"contents": "[\n$0\n]##"}, "context":
47+
[
48+
{ "key": "selector", "operator":"equal", "operand": "punctuation.definition.doc-comment.nim"}
49+
]
50+
},
4451

4552
// Pragma completion
4653
{ "keys": ["."], "command": "insert_snippet", "args": {"contents": ".$0."}, "context":

Default (Windows).sublime-keymap

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@
2424
[
2525
{ "key": "setting.doccontinue.enabled", "operand": true },
2626
{ "key": "selection_empty", "operand": true },
27-
{ "key": "selector", "operand": "comment.line.number-sign.doc-comment.nim" }
27+
{ "key": "selector", "operand": "comment.line.number-sign.doc-comment.body.nim" }
2828
]
2929
},
3030
{ "keys": ["enter"], "command": "insert_snippet", "args": {"contents": "\n## $0"}, "context":
3131
[
3232
{ "key": "setting.doccontinue.enabled", "operand": true },
3333
{ "key": "setting.doccontinue.autostop", "operand": false },
34-
{ "key": "selector", "operand": "comment.line.number-sign.doc-comment.empty.nim"}
34+
{ "key": "selector", "operand": "comment.line.number-sign.doc-comment.nim" },
35+
{ "key": "selector", "operand": "punctuation.definition.doc-comment.nim", "operator": "not_equal" }
3536
]
3637
},
3738

Nim.sublime-settings

Lines changed: 0 additions & 4 deletions
This file was deleted.

NimLime.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,2 @@
11
# coding=utf-8
2-
"""
3-
Stub file for loading the NimLime plugin.
4-
See __init__.py for the actual code.
5-
"""
6-
import os
7-
import sys
8-
9-
root_dir = os.path.dirname(os.path.abspath(__file__))
10-
if sys.version_info < (3, 0):
11-
execfile('__init__.py')
2+
from NimLime.core.commands import *

NimLime.sublime-settings

100644100755
Lines changed: 7 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
{
22
// Misc. Settings //
3-
"nim.executable": "nim",
43
// Executable paths.
54
// These *must* be in absolute form, or the name of the executable
65
// (if it's in the PATH environment variable)
7-
"nimble.executable": "nimble",
8-
"nimsuggest.executable": "nimsuggest",
6+
"nim.executable": "nim",
97
"error_handler.enabled": true,
10-
"error_handler.logpath": "",
8+
"error_handler.logfile_path": "",
119

1210
"translate_tabs_to_spaces": true,
13-
"enable_nim_completions": true,
14-
"provide_immediate_nim_completions": false,
15-
"auto_complete_triggers": [ {"selector": "source.nim", "characters": "."} ],
1611

1712
// Below are settings for various commands and features.
1813
//
@@ -23,7 +18,7 @@
2318
// 'output.send':
2419
// Toggles sending output to an output view.
2520
//
26-
// 'output.clear':
21+
// ' output.clear':
2722
// Toggles clearing previous output when writing the command's output
2823
// to the output view. Has no effect when 'output.send' is false.
2924
//
@@ -69,72 +64,6 @@
6964
"doccontinue.autostop": true,
7065

7166

72-
//// Nimble Interface Settings ////
73-
// Unique settings suffixes:
74-
// 'preemptive_search':
75-
// Perform an initial search using user input. May reduce memory/cpu
76-
// usage when searching via the quickpanel, as not all results are
77-
// loaded.
78-
79-
// Settings for the 'nimble update' command
80-
"nimble.update.enabled": false,
81-
82-
"nimble.update.output.send": false,
83-
"nimble.update.output.show": false,
84-
"nimble.update.output.clear": false,
85-
"nimble.update.output.name": "Nimble Update Output",
86-
"nimble.update.output.method": "grouped",
87-
"nimble.update.output.tag": "nimble",
88-
"nimble.update.output.raw": false,
89-
90-
// Settings for the 'nimble list' command
91-
"nimble.list.enabled": true,
92-
"nimble.list.quickpanel.send": true,
93-
94-
"nimble.list.output.send": false,
95-
"nimble.list.output.show": false,
96-
"nimble.list.output.clear": false,
97-
"nimble.list.output.name": "Nimble List Output",
98-
"nimble.list.output.method": "grouped",
99-
"nimble.list.output.tag": "nimble",
100-
"nimble.list.output.raw": false,
101-
102-
// Settings for the 'nimble search' command
103-
"nimble.search.enabled": true,
104-
"nimble.search.quickpanel.send": true,
105-
106-
"nimble.search.output.send": false,
107-
"nimble.search.output.show": false,
108-
"nimble.search.output.clear": false,
109-
"nimble.search.output.name": "Nimble Search Output",
110-
"nimble.search.output.method": "grouped",
111-
"nimble.search.output.tag": "nimble",
112-
"nimble.search.output.raw": false,
113-
114-
// Settings for the 'nimble install' command
115-
"nimble.install.enabled": true,
116-
"nimble.install.preemptive_search": false,
117-
118-
"nimble.install.output.send": false,
119-
"nimble.install.output.show": false,
120-
"nimble.install.output.clear": false,
121-
"nimble.install.output.name": "Nimble Install Output",
122-
"nimble.install.output.method": "grouped",
123-
"nimble.install.output.tag": "nimble",
124-
"nimble.install.output.raw": false,
125-
126-
// Settings for the 'nimble uninstall' command
127-
"nimble.uninstall.enabled": true,
128-
129-
"nimble.uninstall.output.send": false,
130-
"nimble.uninstall.output.show": false,
131-
"nimble.uninstall.output.clear": false,
132-
"nimble.uninstall.output.name": "Nimble Uninstall Output",
133-
"nimble.uninstall.output.method": "grouped",
134-
"nimble.uninstall.output.tag": "nimble",
135-
"nimble.uninstall.output.raw": false,
136-
137-
13867
//// Nim Check Settings ////
13968
// Unique settings suffixes:
14069
// 'highlight_errors':
@@ -173,9 +102,7 @@
173102

174103
"check.on_save.output.send": false,
175104
"check.on_save.output.show": false,
176-
"check.on_save.output.name": "Nim Check - Current File",
177-
"check.on_save.output.method": "grouped",
178-
"check.on_save.output.clear": false,
105+
// "check.on_save.output.clear": false,
179106
"check.on_save.output.tag": "Nim Check",
180107
"check.on_save.output.raw": false,
181108

@@ -193,9 +120,7 @@
193120

194121
"check.current_file.output.send": false,
195122
"check.current_file.output.show": false,
196-
"check.current_file.output.clear": false,
197-
"check.current_file.output.name": "Nim Check - Current File",
198-
"check.current_file.output.method": "grouped",
123+
// "check.current_file.output.clear": false,
199124
"check.current_file.output.tag": "Nim Check",
200125
"check.current_file.output.raw": false,
201126

@@ -205,19 +130,10 @@
205130

206131
"check.external_file.output.send": true,
207132
"check.external_file.output.show": true,
208-
"check.external_file.output.clear": true,
209-
"check.external_file.output.name": "Nim Check - External File",
210-
"check.external_file.output.method": "grouped",
211-
"check.external_file.output.include_context": true,
133+
// "check.external_file.output.clear": true,
212134
"check.external_file.output.tag": "Nim Check",
213135
"check.external_file.output.raw": false,
214136

215137
// Settings for the 'clear errors' command
216-
"check.clear_errors.enabled": true,
217-
218-
// IDE Tool Settings //
219-
"idetools.find_definition.enabled": true,
220-
"idetools.find_usages.enabled": true,
221-
"idetools.find_current_file_usages.enabled": true,
222-
"idetools.get_suggestions.enabled": true
138+
"check.clear_errors.enabled": true
223139
}

Support/Main.sublime-menu

Lines changed: 11 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
[
22
{
3-
"caption": "Preferences",
4-
"mnemonic": "n",
53
"id": "preferences",
64
"children":
75
[
86
{
9-
"caption": "Package Settings",
10-
"mnemonic": "P",
117
"id": "package-settings",
128
"children":
139
[
@@ -16,85 +12,29 @@
1612
"children":
1713
[
1814
{
19-
"caption": "NimLime",
20-
"id": "nimlime",
21-
"children":
22-
[
23-
{
24-
"command": "nim_lime_open_support",
25-
"caption": "Support/Issue Tracker"
26-
}
27-
]
28-
},
29-
30-
{ "caption": "-" },
31-
32-
{
33-
"command": "open_file", "args":
34-
{
35-
"file": "${packages}/NimLime/NimLime.sublime-settings"
36-
},
37-
"caption": "Settings – Default"
38-
},
39-
{
40-
"command": "open_file", "args":
41-
{
42-
"file": "${packages}/User/NimLime.sublime-settings"
43-
},
44-
"caption": "Settings – User"
15+
"command": "nim_lime_open_support",
16+
"caption": "Support/Issue Tracker"
4517
},
4618

4719
{ "caption": "-" },
4820

49-
5021
{
51-
"command": "open_file", "args":
22+
"command": "edit_settings", "args":
5223
{
53-
"file": "${packages}/NimLime/Default (OSX).sublime-keymap",
54-
"platform": "OSX"
24+
"base_file": "${packages}/NimLime/NimLime.sublime-settings",
25+
"default": "{\n\t$0\n}\n"
5526
},
56-
"caption": "Key Bindings – Default"
57-
},
58-
{
59-
"command": "open_file", "args":
60-
{
61-
"file": "${packages}/NimLime/Default (Linux).sublime-keymap",
62-
"platform": "Linux"
63-
},
64-
"caption": "Key Bindings – Default"
65-
},
66-
{
67-
"command": "open_file",
68-
"args": {
69-
"file": "${packages}/NimLime/Default (Windows).sublime-keymap",
70-
"platform": "Windows"
71-
},
72-
"caption": "Key Bindings – Default"
27+
"caption": "Settings"
7328
},
7429

7530
{
76-
"command": "open_file", "args":
77-
{
78-
"file": "${packages}/User/Default (OSX).sublime-keymap",
79-
"platform": "OSX"
80-
},
81-
"caption": "Key Bindings – User"
82-
},
83-
{
84-
"command": "open_file", "args":
31+
"command": "edit_settings", "args":
8532
{
86-
"file": "${packages}/User/Default (Linux).sublime-keymap",
87-
"platform": "Linux"
88-
},
89-
"caption": "Key Bindings – User"
90-
},
91-
{
92-
"command": "open_file",
93-
"args": {
94-
"file": "${packages}/User/Default (Windows).sublime-keymap",
95-
"platform": "Windows"
33+
"base_file": "${packages}/NimLime/Default ($platform).sublime-keymap",
34+
// TODO: is this correct? not sure when / how this is used
35+
"default": "{\n\t$0\n}\n"
9636
},
97-
"caption": "Key Bindings – User"
37+
"caption": "Key Bindings"
9838
}
9939
]
10040
}

0 commit comments

Comments
 (0)