mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 02:36:01 +02:00
Disable formatter problem logging for code templates and preview
This commit is contained in:
parent
777bb96452
commit
ada2801b8f
2 changed files with 12 additions and 3 deletions
|
@ -32,6 +32,7 @@ import org.eclipse.cdt.core.parser.ScannerInfo;
|
||||||
import org.eclipse.cdt.internal.core.dom.SavedCodeReaderFactory;
|
import org.eclipse.cdt.internal.core.dom.SavedCodeReaderFactory;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.text.edits.TextEdit;
|
import org.eclipse.text.edits.TextEdit;
|
||||||
|
|
||||||
public class CCodeFormatter extends CodeFormatter {
|
public class CCodeFormatter extends CodeFormatter {
|
||||||
|
@ -147,6 +148,10 @@ public class CCodeFormatter extends CodeFormatter {
|
||||||
}
|
}
|
||||||
CodeFormatterVisitor codeFormatter = new CodeFormatterVisitor(this.preferences, this.options, offset, length);
|
CodeFormatterVisitor codeFormatter = new CodeFormatterVisitor(this.preferences, this.options, offset, length);
|
||||||
edit= codeFormatter.format(source, ast);
|
edit= codeFormatter.format(source, ast);
|
||||||
|
IStatus status= codeFormatter.getStatus();
|
||||||
|
if (!status.isOK()) {
|
||||||
|
CCorePlugin.log(status);
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
index.releaseReadLock();
|
index.releaseReadLock();
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,12 +237,16 @@ public class CodeFormatterVisitor extends CPPASTVisitor {
|
||||||
if (DEBUG){
|
if (DEBUG){
|
||||||
System.out.println("Formatting time: " + (System.currentTimeMillis() - startTime)); //$NON-NLS-1$
|
System.out.println("Formatting time: " + (System.currentTimeMillis() - startTime)); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
if (!fStatus.isOK()) {
|
|
||||||
CCorePlugin.log(fStatus);
|
|
||||||
}
|
|
||||||
return scribe.getRootEdit();
|
return scribe.getRootEdit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the status collected during formatting
|
||||||
|
*/
|
||||||
|
IStatus getStatus() {
|
||||||
|
return fStatus;
|
||||||
|
}
|
||||||
|
|
||||||
private final TextEdit failedToFormat(RuntimeException e) {
|
private final TextEdit failedToFormat(RuntimeException e) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
System.out.println("COULD NOT FORMAT: " + e.getMessage()); //$NON-NLS-1$
|
System.out.println("COULD NOT FORMAT: " + e.getMessage()); //$NON-NLS-1$
|
||||||
|
|
Loading…
Add table
Reference in a new issue