Skip to content

Commit 977791d

Browse files
committed
Fix eventlistener bug
1 parent 73ad408 commit 977791d

3 files changed

Lines changed: 163 additions & 11 deletions

File tree

Clara.sublime-project

Lines changed: 150 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,160 @@
22
"build_systems":
33
[
44
{
5-
"file_regex": "^(/.[^:]*):(\\d+):(\\d+): (?:fatal )?(?:error|warning): (.*)$",
5+
"file_regex": "(.+[^:]):(\\d+):(\\d+): (?:fatal )?((?:error|warning): .+)$",
66
"name": "Clara",
77
"shell_cmd": "cmake --build .",
8+
"syntax": "Packages/CMakeBuilder/Syntax/Ninja.sublime-syntax",
89
"variants":
910
[
1011
{
11-
"name": "Clara",
12-
"shell_cmd": "cmake --build . --target Clara"
12+
"name": "tools/clang/tools/Clara/install/local",
13+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/install/local"
14+
},
15+
{
16+
"name": "tools/clang/tools/Clara/install/strip",
17+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/install/strip"
18+
},
19+
{
20+
"name": "tools/clang/tools/Clara/install",
21+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/install"
22+
},
23+
{
24+
"name": "tools/clang/tools/Clara/package_source",
25+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/package_source"
26+
},
27+
{
28+
"name": "tools/clang/tools/Clara/rebuild_cache",
29+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/rebuild_cache"
30+
},
31+
{
32+
"name": "tools/clang/tools/Clara/package",
33+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/package"
34+
},
35+
{
36+
"name": "tools/clang/tools/Clara/list_install_components",
37+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/list_install_components"
38+
},
39+
{
40+
"name": "tools/clang/tools/Clara/plugin/install/local",
41+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/plugin/install/local"
42+
},
43+
{
44+
"name": "tools/clang/tools/Clara/plugin/list_install_components",
45+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/plugin/list_install_components"
46+
},
47+
{
48+
"name": "tools/clang/tools/Clara/plugin/package_source",
49+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/plugin/package_source"
50+
},
51+
{
52+
"name": "tools/clang/tools/Clara/plugin/rebuild_cache",
53+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/plugin/rebuild_cache"
54+
},
55+
{
56+
"name": "tools/clang/tools/Clara/plugin/package",
57+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/plugin/package"
58+
},
59+
{
60+
"name": "tools/clang/tools/Clara/plugin/install/strip",
61+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/plugin/install/strip"
62+
},
63+
{
64+
"name": "tools/clang/tools/Clara/plugin/install",
65+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/plugin/install"
66+
},
67+
{
68+
"name": "tools/clang/tools/Clara/lib/install/local",
69+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/lib/install/local"
70+
},
71+
{
72+
"name": "tools/clang/tools/Clara/lib/install/strip",
73+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/lib/install/strip"
74+
},
75+
{
76+
"name": "tools/clang/tools/Clara/lib/install",
77+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/lib/install"
78+
},
79+
{
80+
"name": "tools/clang/tools/Clara/lib/list_install_components",
81+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/lib/list_install_components"
82+
},
83+
{
84+
"name": "tools/clang/tools/Clara/lib/package",
85+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/lib/package"
86+
},
87+
{
88+
"name": "tools/clang/tools/Clara/lib/rebuild_cache",
89+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/lib/rebuild_cache"
90+
},
91+
{
92+
"name": "tools/clang/tools/Clara/lib/package_source",
93+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/lib/package_source"
94+
},
95+
{
96+
"name": "tools/clang/tools/Clara/lib/pybind11/install/local",
97+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/lib/pybind11/install/local"
98+
},
99+
{
100+
"name": "tools/clang/tools/Clara/lib/pybind11/install/strip",
101+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/lib/pybind11/install/strip"
102+
},
103+
{
104+
"name": "tools/clang/tools/Clara/lib/pybind11/install",
105+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/lib/pybind11/install"
106+
},
107+
{
108+
"name": "tools/clang/tools/Clara/lib/pybind11/list_install_components",
109+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/lib/pybind11/list_install_components"
110+
},
111+
{
112+
"name": "tools/clang/tools/Clara/lib/pybind11/package_source",
113+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/lib/pybind11/package_source"
114+
},
115+
{
116+
"name": "tools/clang/tools/Clara/lib/pybind11/rebuild_cache",
117+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/lib/pybind11/rebuild_cache"
118+
},
119+
{
120+
"name": "tools/clang/tools/Clara/lib/pybind11/package",
121+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/lib/pybind11/package"
122+
},
123+
{
124+
"name": "tools/clang/tools/Clara/include/install/local",
125+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/include/install/local"
126+
},
127+
{
128+
"name": "tools/clang/tools/Clara/include/install/strip",
129+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/include/install/strip"
130+
},
131+
{
132+
"name": "tools/clang/tools/Clara/include/install",
133+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/include/install"
134+
},
135+
{
136+
"name": "tools/clang/tools/Clara/include/package_source",
137+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/include/package_source"
138+
},
139+
{
140+
"name": "tools/clang/tools/Clara/include/rebuild_cache",
141+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/include/rebuild_cache"
142+
},
143+
{
144+
"name": "tools/clang/tools/Clara/include/list_install_components",
145+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/include/list_install_components"
146+
},
147+
{
148+
"name": "tools/clang/tools/Clara/include/package",
149+
"shell_cmd": "cmake --build . --target tools/clang/tools/Clara/include/package"
13150
},
14151
{
15152
"name": "ClaraInstall",
16153
"shell_cmd": "cmake --build . --target ClaraInstall"
17154
},
155+
{
156+
"name": "ClaraPackage",
157+
"shell_cmd": "cmake --build . --target ClaraPackage"
158+
},
18159
{
19160
"name": "ClaraPlugin",
20161
"shell_cmd": "cmake --build . --target ClaraPlugin"
@@ -28,17 +169,17 @@
28169
"build_folder": "${project_path}/../../../../build/release",
29170
"command_line_overrides":
30171
{
172+
"CMAKE_BUILD_TYPE": "Release",
173+
"CMAKE_EXPORT_COMPILE_COMMANDS": true,
31174
"LLVM_ENABLE_EH": true,
32175
"LLVM_ENABLE_RTTI": true,
33-
"LLVM_TARGETS_TO_BUILD": "X86",
34-
"CMAKE_BUILD_TYPE": "Debug",
35-
"CMAKE_EXPORT_COMPILE_COMMANDS": true
176+
// "LLVM_TARGETS_TO_BUILD": "X86"
36177
},
37-
"generator": "Ninja",
38178
"filter_targets":
39179
[
40180
"Clara"
41181
],
182+
"generator": "Ninja",
42183
"root_folder": "${project_path}/../../../.."
43184
},
44185
"folders":
@@ -58,14 +199,14 @@
58199
],
59200
"settings":
60201
{
61-
"ClangFormat":
202+
"ClangFormat":
62203
{
63204
"based_on_style": "File",
64205
"format_on_save": true
65206
},
66207
"flags_sources":
67208
{
68-
"file": "compile_commands.json",
209+
"file": "compile_commands.json",
69210
"search_in": "${project_path}/../../../../build"
70211
},
71212
"tab_size": 4

plugin/EventListener.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ def on_query_completions(self, view, prefix, locations):
4444
def on_activated(self, view):
4545
ensure_compilation_database_exists_for_view(view)
4646

47+
def on_post_window_command(self, window, command_name, args):
48+
clara_print('Got window command: ' + command_name)
49+
if command_name == 'cmake_configure':
50+
def f():
51+
clara_print('Reloading compilation database for window {}'.format(window.id()))
52+
load_compilation_database_for_window(window)
53+
sublime.set_timeout(f, 1000)
54+
4755
def _get_file_buffer_data_for_view(self, view):
4856
file_name = view.file_name()
4957
if view.is_scratch() or not file_name:
@@ -76,4 +84,4 @@ def _ensure_view_is_loaded(self, view):
7684
else:
7785
clara_print('Did not load {}, {}'
7886
.format(view.id(), view.file_name()))
79-
return False
87+
return False

plugin/InsertDiagnosis.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import sublime, sublime_plugin, subprocess, os
1+
import sublime, sublime_plugin, subprocess, os, shutil
22

33
def getFromShell(str):
44
return subprocess.check_output(str, shell=True).decode('utf-8').strip()
@@ -9,6 +9,9 @@ def __init__(self, view):
99
super(ClaraInsertDiagnosisCommand, self).__init__(view)
1010
self.errorCount = 0
1111

12+
def _command_exists(cmd):
13+
return shutil.which(cmd) is not None
14+
1215
def run(self, edit):
1316
self._diagnose(edit)
1417
if self.errorCount == 0:

0 commit comments

Comments
 (0)