Permalink
Browse files

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...
1 parent 4e14bfc commit 2bc5cefe5cef85c67bd8cd411984d97a31573cd7 @quarnster committed Dec 10, 2011
Showing with 63 additions and 13 deletions.
  1. +2 −2 Default.sublime-commands
  2. +2 −2 Main.sublime-menu
  3. +2 −2 README.creole
  4. +43 −0 SublimeClang.sublime-settings
  5. +1 −1 errormarkers.py
  6. +13 −6 sublimeclang.py
View
@@ -3,14 +3,14 @@
"caption": "Preferences: SublimeClang Settings – Default",
"command": "open_file", "args":
{
- "file": "${packages}/SublimeClang/clang.sublime-settings"
+ "file": "${packages}/SublimeClang/SublimeClang.sublime-settings"
}
},
{
"caption": "Preferences: SublimeClang Settings – User",
"command": "open_file", "args":
{
- "file": "${packages}/User/clang.sublime-settings"
+ "file": "${packages}/User/SublimeClang.sublime-settings"
}
},
{
View
@@ -18,14 +18,14 @@
{
"command": "open_file", "args":
{
- "file": "${packages}/SublimeClang/clang.sublime-settings"
+ "file": "${packages}/SublimeClang/SublimeClang.sublime-settings"
},
"caption": "Settings – Default"
},
{
"command": "open_file", "args":
{
- "file": "${packages}/User/clang.sublime-settings"
+ "file": "${packages}/User/SublimeClang.sublime-settings"
},
"caption": "Settings – User"
},
View
@@ -11,7 +11,7 @@ Clang plugin for Sublime Text 2 providing auto complete suggestions for C/C++/Ob
### Go to your packages directory and type:
#### git clone https://github.com/quarnster/SublimeClang SublimeClang
# Back in the editor, open up the command palette by pressing cmd+shift+P or ctrl+shift+P
- # 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.
+ # 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.
=== Usage ===
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
|ctrl+d,ctrl+d|Go to the parent reference of whatever is under the current cursor position|
|ctrl+d,ctrl+i|Go to the implementation|
- |ctrl+d,crtl+b|Go back to where you were before hitting ctrl+d,ctrl+d or ctrl+d,ctrl+i|
+ |ctrl+d,ctrl+b|Go back to where you were before hitting ctrl+d,ctrl+d or ctrl+d,ctrl+i|
|ctrl+d,ctrl+c|Clear the cache. Will force all files to be reparsed when needed|
=== License ===
@@ -0,0 +1,43 @@
+{
+ // Delay in ms until autocompletion pops up after . or :: or ->
+ // Set to 0 to disable
+ "popup_delay": 100,
+
+ // Delay in ms until recompiling the file after the buffer is modified
+ // Set to 0 to disable
+ "recompile_delay": 1000,
+
+ // Whether or not to hide the clang output panel when it's empty
+ "hide_output_when_empty": false,
+
+ // When set to true, will display visual error markers. recompile_delay
+ // must be set to > 0
+ "show_visual_error_marks": true,
+
+ // This is the bitmask sent to index.parse.
+ // For example, to be able to go to the definition of
+ // preprocessed macros, set it to 1.
+ //
+ // See http://clang.llvm.org/doxygen/group__CINDEX__TRANSLATION__UNIT.html#gab1e4965c1ebe8e41d71e90203a723fe9
+ // and http://clang.llvm.org/doxygen/Index_8h_source.html
+ // for more details
+ "index_parse_options": 1,
+
+ // Don't show stuff in the autocomplete list when the name starts with the following
+ "dont_complete_startswith":
+ [
+ "~",
+ "operator"
+ ],
+
+ // If set to true it'll add for example "-x c++" to the options for c++ files
+ "add_language_option": true,
+
+ // Any options you want to give to clang
+ "options":
+ [
+ "-Wall",
+ "-I/path/to/sources/1",
+ "-I/path/to/sources/2"
+ ]
+}
View
@@ -27,7 +27,7 @@ def add_error_mark(severity, filename, line, message):
def show_error_marks(view):
'''Adds error marks to view.'''
erase_error_marks(view)
- if not sublime.load_settings("clang.sublime-settings").get("show_visual_error_marks", True):
+ if not sublime.load_settings("SublimeClang.sublime-settings").get("show_visual_error_marks", True):
return
fill_outlines = False
gutter_mark = 'dot'
View
@@ -47,7 +47,7 @@ def get_translation_unit(filename):
index = cindex.Index.create()
tu = None
if filename not in translationUnits:
- s = sublime.load_settings("clang.sublime-settings")
+ s = sublime.load_settings("SublimeClang.sublime-settings")
opts = []
if s.has("options"):
opts = s.get("options")
@@ -68,8 +68,10 @@ def get_translation_unit(filename):
tu = translationUnits[filename]
return tu
+
navigation_stack = []
+
class ClangGoBackEventListener(sublime_plugin.EventListener):
def on_close(self, view):
# If the view we just closed was last in the navigation_stack,
@@ -106,6 +108,7 @@ def open(view, target):
navigation_stack.append((format_current_file(view), target))
view.window().open_file(target, sublime.ENCODED_POSITION)
+
class ClangGotoImplementation(sublime_plugin.TextCommand):
def run(self, edit):
view = self.view
@@ -140,7 +143,6 @@ def run(self, edit):
class ClangGotoDef(sublime_plugin.TextCommand):
-
def quickpanel_on_done(self, idx):
if idx == -1:
return
@@ -182,15 +184,17 @@ def run(self, edit):
else:
sublime.status_message("No parent to go to!")
+
class ClangClearCache(sublime_plugin.TextCommand):
def run(self, edit):
global translationUnits
translationUnits.clear()
sublime.status_message("Cache cleared!")
+
class SublimeClangAutoComplete(sublime_plugin.EventListener):
def __init__(self):
- s = sublime.load_settings("clang.sublime-settings")
+ s = sublime.load_settings("SublimeClang.sublime-settings")
s.clear_on_change("options")
s.add_on_change("options", self.load_settings)
self.load_settings(s)
@@ -203,12 +207,15 @@ def __init__(self):
def load_settings(self, s=None):
global translationUnits
translationUnits.clear()
+ oldSettings = sublime.load_settings("clang.sublime-settings")
+ if oldSettings.get("popup_delay") != None:
+ 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.")
if s == None:
- s = sublime.load_settings("clang.sublime-settings")
+ s = sublime.load_settings("SublimeClang.sublime-settings")
if s.get("popupDelay") != None:
- sublime.error_message("SublimeClang changed the 'popupDelay' setting to 'popup_delay, please edit your clang.sublime-settings to match this")
+ sublime.error_message("SublimeClang changed the 'popupDelay' setting to 'popup_delay, please edit your SublimeClang.sublime-settings to match this")
if s.get("recompileDelay") != None:
- sublime.error_message("SublimeClang changed the 'recompileDelay' setting to 'recompile_delay, please edit your clang.sublime-settings to match this")
+ sublime.error_message("SublimeClang changed the 'recompileDelay' setting to 'recompile_delay, please edit your SublimeClang.sublime-settings to match this")
self.popup_delay = s.get("popup_delay", 500)
self.dont_complete_startswith = s.get("dont_complete_startswith", ['operator', '~'])
self.recompile_delay = s.get("recompile_delay", 1000)

0 comments on commit 2bc5cef

Please sign in to comment.