This repository was archived by the owner on Aug 7, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -214,10 +214,12 @@ export default {
214
214
args . push ( `-I${ path } ` ) ,
215
215
) ;
216
216
217
+ let usingClangComplete = false ;
217
218
try {
218
219
const flags = clangFlags . getClangFlags ( filePath ) ;
219
- if ( flags ) {
220
+ if ( flags . length > 0 ) {
220
221
args . push ( ...flags ) ;
222
+ usingClangComplete = true ;
221
223
}
222
224
} catch ( error ) {
223
225
if ( atom . inDevMode ( ) ) {
@@ -226,15 +228,25 @@ export default {
226
228
}
227
229
}
228
230
229
- args . push ( '-' ) ;
231
+ if ( editor . isModified ( ) && usingClangComplete ) {
232
+ // If the user has a .clang-complete file we can't lint current
233
+ // TextEditor contents, return null so nothing gets modified
234
+ return null ;
235
+ }
230
236
231
237
const execOpts = {
232
- stdin : fileText ,
233
238
stream : 'stderr' ,
234
239
allowEmptyStderr : true ,
235
- cwd : fileDir ,
236
240
} ;
237
241
242
+ if ( usingClangComplete ) {
243
+ args . push ( filePath ) ;
244
+ } else {
245
+ args . push ( '-' ) ;
246
+ execOpts . stdin = fileText ;
247
+ execOpts . cwd = fileDir ;
248
+ }
249
+
238
250
const output = await helpers . exec ( this . executablePath , args , execOpts ) ;
239
251
240
252
if ( editor . getText ( ) !== fileText ) {
You can’t perform that action at this time.
0 commit comments