Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Configuration file renamed

Just found out that the default settings file needs to be named
as the directory it resides in, or it won't be picked up.
  • Loading branch information...
commit 2bc5cefe5cef85c67bd8cd411984d97a31573cd7 1 parent 4e14bfc
Fredrik Ehnbom authored
4 Default.sublime-commands
@@ -3,14 +3,14 @@
3 3 "caption": "Preferences: SublimeClang Settings – Default",
4 4 "command": "open_file", "args":
5 5 {
6   - "file": "${packages}/SublimeClang/clang.sublime-settings"
  6 + "file": "${packages}/SublimeClang/SublimeClang.sublime-settings"
7 7 }
8 8 },
9 9 {
10 10 "caption": "Preferences: SublimeClang Settings – User",
11 11 "command": "open_file", "args":
12 12 {
13   - "file": "${packages}/User/clang.sublime-settings"
  13 + "file": "${packages}/User/SublimeClang.sublime-settings"
14 14 }
15 15 },
16 16 {
4 Main.sublime-menu
@@ -18,14 +18,14 @@
18 18 {
19 19 "command": "open_file", "args":
20 20 {
21   - "file": "${packages}/SublimeClang/clang.sublime-settings"
  21 + "file": "${packages}/SublimeClang/SublimeClang.sublime-settings"
22 22 },
23 23 "caption": "Settings – Default"
24 24 },
25 25 {
26 26 "command": "open_file", "args":
27 27 {
28   - "file": "${packages}/User/clang.sublime-settings"
  28 + "file": "${packages}/User/SublimeClang.sublime-settings"
29 29 },
30 30 "caption": "Settings – User"
31 31 },
4 README.creole
Source Rendered
@@ -11,7 +11,7 @@ Clang plugin for Sublime Text 2 providing auto complete suggestions for C/C++/Ob
11 11 ### Go to your packages directory and type:
12 12 #### git clone https://github.com/quarnster/SublimeClang SublimeClang
13 13 # Back in the editor, open up the command palette by pressing cmd+shift+P or ctrl+shift+P
14   - # Type SublimeClang and open up the settings file you want to modify with any include directories or other options you want to provide to clang. You might have to tweak the User configuration rather than the default.
  14 + # Type SublimeClang and open up the settings file you want to modify with any include directories or other options you want to provide to clang.
15 15
16 16 === Usage ===
17 17 After installation, suggestions from clang should be provided when triggering the autocomplete operation in Sublime Text 2. It'll not disable the built in completion.
@@ -22,7 +22,7 @@ There's also the following key-bindings (tweak Default.sublime-keymaps to change
22 22
23 23 |ctrl+d,ctrl+d|Go to the parent reference of whatever is under the current cursor position|
24 24 |ctrl+d,ctrl+i|Go to the implementation|
25   - |ctrl+d,crtl+b|Go back to where you were before hitting ctrl+d,ctrl+d or ctrl+d,ctrl+i|
  25 + |ctrl+d,ctrl+b|Go back to where you were before hitting ctrl+d,ctrl+d or ctrl+d,ctrl+i|
26 26 |ctrl+d,ctrl+c|Clear the cache. Will force all files to be reparsed when needed|
27 27
28 28 === License ===
43 SublimeClang.sublime-settings
... ... @@ -0,0 +1,43 @@
  1 +{
  2 + // Delay in ms until autocompletion pops up after . or :: or ->
  3 + // Set to 0 to disable
  4 + "popup_delay": 100,
  5 +
  6 + // Delay in ms until recompiling the file after the buffer is modified
  7 + // Set to 0 to disable
  8 + "recompile_delay": 1000,
  9 +
  10 + // Whether or not to hide the clang output panel when it's empty
  11 + "hide_output_when_empty": false,
  12 +
  13 + // When set to true, will display visual error markers. recompile_delay
  14 + // must be set to > 0
  15 + "show_visual_error_marks": true,
  16 +
  17 + // This is the bitmask sent to index.parse.
  18 + // For example, to be able to go to the definition of
  19 + // preprocessed macros, set it to 1.
  20 + //
  21 + // See http://clang.llvm.org/doxygen/group__CINDEX__TRANSLATION__UNIT.html#gab1e4965c1ebe8e41d71e90203a723fe9
  22 + // and http://clang.llvm.org/doxygen/Index_8h_source.html
  23 + // for more details
  24 + "index_parse_options": 1,
  25 +
  26 + // Don't show stuff in the autocomplete list when the name starts with the following
  27 + "dont_complete_startswith":
  28 + [
  29 + "~",
  30 + "operator"
  31 + ],
  32 +
  33 + // If set to true it'll add for example "-x c++" to the options for c++ files
  34 + "add_language_option": true,
  35 +
  36 + // Any options you want to give to clang
  37 + "options":
  38 + [
  39 + "-Wall",
  40 + "-I/path/to/sources/1",
  41 + "-I/path/to/sources/2"
  42 + ]
  43 +}
2  errormarkers.py
@@ -27,7 +27,7 @@ def add_error_mark(severity, filename, line, message):
27 27 def show_error_marks(view):
28 28 '''Adds error marks to view.'''
29 29 erase_error_marks(view)
30   - if not sublime.load_settings("clang.sublime-settings").get("show_visual_error_marks", True):
  30 + if not sublime.load_settings("SublimeClang.sublime-settings").get("show_visual_error_marks", True):
31 31 return
32 32 fill_outlines = False
33 33 gutter_mark = 'dot'
19 sublimeclang.py
@@ -47,7 +47,7 @@ def get_translation_unit(filename):
47 47 index = cindex.Index.create()
48 48 tu = None
49 49 if filename not in translationUnits:
50   - s = sublime.load_settings("clang.sublime-settings")
  50 + s = sublime.load_settings("SublimeClang.sublime-settings")
51 51 opts = []
52 52 if s.has("options"):
53 53 opts = s.get("options")
@@ -68,8 +68,10 @@ def get_translation_unit(filename):
68 68 tu = translationUnits[filename]
69 69 return tu
70 70
  71 +
71 72 navigation_stack = []
72 73
  74 +
73 75 class ClangGoBackEventListener(sublime_plugin.EventListener):
74 76 def on_close(self, view):
75 77 # If the view we just closed was last in the navigation_stack,
@@ -106,6 +108,7 @@ def open(view, target):
106 108 navigation_stack.append((format_current_file(view), target))
107 109 view.window().open_file(target, sublime.ENCODED_POSITION)
108 110
  111 +
109 112 class ClangGotoImplementation(sublime_plugin.TextCommand):
110 113 def run(self, edit):
111 114 view = self.view
@@ -140,7 +143,6 @@ def run(self, edit):
140 143
141 144
142 145 class ClangGotoDef(sublime_plugin.TextCommand):
143   -
144 146 def quickpanel_on_done(self, idx):
145 147 if idx == -1:
146 148 return
@@ -182,15 +184,17 @@ def run(self, edit):
182 184 else:
183 185 sublime.status_message("No parent to go to!")
184 186
  187 +
185 188 class ClangClearCache(sublime_plugin.TextCommand):
186 189 def run(self, edit):
187 190 global translationUnits
188 191 translationUnits.clear()
189 192 sublime.status_message("Cache cleared!")
190 193
  194 +
191 195 class SublimeClangAutoComplete(sublime_plugin.EventListener):
192 196 def __init__(self):
193   - s = sublime.load_settings("clang.sublime-settings")
  197 + s = sublime.load_settings("SublimeClang.sublime-settings")
194 198 s.clear_on_change("options")
195 199 s.add_on_change("options", self.load_settings)
196 200 self.load_settings(s)
@@ -203,12 +207,15 @@ def __init__(self):
203 207 def load_settings(self, s=None):
204 208 global translationUnits
205 209 translationUnits.clear()
  210 + oldSettings = sublime.load_settings("clang.sublime-settings")
  211 + if oldSettings.get("popup_delay") != None:
  212 + sublime.error_message("SublimeClang's configuration file name was changed from 'clang.sublime-settings' to 'SublimeClang.sublime-settings'. Please move your settings over to this new file and delete the old one.")
206 213 if s == None:
207   - s = sublime.load_settings("clang.sublime-settings")
  214 + s = sublime.load_settings("SublimeClang.sublime-settings")
208 215 if s.get("popupDelay") != None:
209   - sublime.error_message("SublimeClang changed the 'popupDelay' setting to 'popup_delay, please edit your clang.sublime-settings to match this")
  216 + sublime.error_message("SublimeClang changed the 'popupDelay' setting to 'popup_delay, please edit your SublimeClang.sublime-settings to match this")
210 217 if s.get("recompileDelay") != None:
211   - sublime.error_message("SublimeClang changed the 'recompileDelay' setting to 'recompile_delay, please edit your clang.sublime-settings to match this")
  218 + sublime.error_message("SublimeClang changed the 'recompileDelay' setting to 'recompile_delay, please edit your SublimeClang.sublime-settings to match this")
212 219 self.popup_delay = s.get("popup_delay", 500)
213 220 self.dont_complete_startswith = s.get("dont_complete_startswith", ['operator', '~'])
214 221 self.recompile_delay = s.get("recompile_delay", 1000)

0 comments on commit 2bc5cef

Please sign in to comment.
Something went wrong with that request. Please try again.