Skip to content

Allow sourcing dirconfig settings from custom configuration files - #2200

Open
attilayener wants to merge 2 commits into
bbatsov:masterfrom
attilayener:dirconfig-parsers
Open

attilayener wants to merge 2 commits into
bbatsov:masterfrom
attilayener:dirconfig-parsers

Conversation

@attilayener

Copy link
Copy Markdown

Fixes #2197

Problem

Projectile can only parse project settings from its own .projectile
file. Projects that already carry a machine-readable configuration file
(e.g. an Eclipse .project' XML) cannot feed it into Projectile - the user has to maintain the same information twice, and pointing projectile-dirconfig-file' at such a file just makes the built-in
parser choke on its contents.

Solution

As proposed in #2197, this adds projectile-dirconfig-parsers: an
alist of configuration file names and parser functions. When a project
root has no projectile-dirconfig-file', the parser of the first file from the list found in the root is called with the file's absolute path and must return a projectile-dirconfig' structure (or nil).

  • the built-in `.projectile' handling keeps precedence and is unchanged
  • custom parsers can delegate to the new `projectile-read-dirconfig-file'
  • parse results flow through the existing per-root cache; the cached
    entry records the resolved file's path and mtime, so edits invalidate
    it exactly like the built-in file
  • the prefixless/glob `+' warnings now name the file the config was
    actually parsed from
  • documented in doc/modules/ROOT/pages/ignoring.adoc
  • covered by tests in test/projectile-ignore-test.el
  • changelog entry added
;; example: parse an Eclipse .project file
(setq projectile-dirconfig-parsers
      '((".project" . my-eclipse-project-parser)))

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Allow users to configure parsing function for dirconfig file

1 participant