Skip to content

Fixes #294 - selectively exclude hidden directories #560

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions shared/src/main/kotlin/org/javacs/kt/SourceExclusions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ class SourceExclusions(
private val workspaceRoots: Collection<Path>,
private val scriptsConfig: ScriptsConfiguration
) {
val excludedPatterns = (listOf(
".*", "bazel-*", "bin", "build", "node_modules", "target"
val excludedPatterns = (listOf(
".git", ".hg", ".svn", // Version control systems
".idea", ".idea_modules", ".vs", ".vscode", ".code-workspace", ".settings", // IDEs
"bazel-*", "bin", "build", "node_modules", "target", // Build systems
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I would rather integrate with .gitignore or a custom file (e.g. .klsignore) than adding to this ever-growing list of hardcoded directories... my worry is that directory names like target are already so generic, that there might be non-Maven-projects that place their source code there, for example

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, i noticed your TODO for it, and this is really a problem

I'm not sure about reading .gitignore, because some autogenerated files may be ignored, but should be loaded as sources - just like you worry about target.

Consider this PR more like "hotfix" rather than solid improvement:)

Copy link
Owner

@fwcd fwcd Mar 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I agree, in the long term we have got to come up with a proper solution... but for now this fix shouldn't hurt.

) + when {
!scriptsConfig.enabled -> listOf("*.kts")
!scriptsConfig.buildScriptsEnabled -> listOf("*.gradle.kts")
Expand Down