Skip to content

Commit 2e3cdae

Browse files
committed
Task #116 - Ignore EXCLUDED_DIRS while formating entire projects Alt+Shift+F
1 parent bf7db73 commit 2e3cdae

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/org/netbeans/modules/python/editor/PythonReformatTask.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import javax.swing.text.BadLocationException;
1414
import javax.swing.text.Document;
1515
import javax.swing.text.StyledDocument;
16+
import org.apache.commons.lang3.StringUtils;
1617
import org.eclipse.lsp4j.DocumentFormattingParams;
1718
import org.eclipse.lsp4j.DocumentRangeFormattingParams;
1819
import org.eclipse.lsp4j.FormattingOptions;
@@ -25,6 +26,7 @@
2526
import org.netbeans.modules.editor.indent.spi.ExtraLock;
2627
import org.netbeans.modules.lsp.client.LSPBindings;
2728
import org.netbeans.modules.lsp.client.Utils;
29+
import org.netbeans.modules.python.PythonUtility;
2830
import org.openide.filesystems.FileObject;
2931
import org.openide.text.NbDocument;
3032
import org.openide.util.Exceptions;
@@ -43,7 +45,8 @@ public void reformat() throws BadLocationException {
4345
Document document = context.document();
4446
boolean rangeOrDoc = context.startOffset() != 0;
4547
FileObject fileObject = NbEditorUtilities.getFileObject(document);
46-
if (fileObject != null) {
48+
if (fileObject != null && !StringUtils.containsAny(fileObject.getPath(),
49+
PythonUtility.EXCLUDED_DIRS)) {
4750
LSPBindings bindings = LSPBindings.getBindings(fileObject);
4851
if (bindings != null) {
4952
boolean documentFormatting = Utils.isEnabled(bindings

0 commit comments

Comments
 (0)