Skip to content
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

Temporary editor files trigger a server rebuild #341

Open
Profpatsch opened this issue May 1, 2018 · 6 comments
Open

Temporary editor files trigger a server rebuild #341

Profpatsch opened this issue May 1, 2018 · 6 comments

Comments

@Profpatsch
Copy link
Contributor

Emacs creates so-called lock files on edit, which are files starting with .#, e.g. .#Main.purs.
This causes server to trigger a rebuild on every edit.

I am torn on what the correct solution to this problem is:

  • notabug
    • users will have to manage their filechanges and adjust their editors accordingly
  • a fixed list of watch exceptions in pulp:
    • will have to be added for all editors on bug reports
    • introduces “magic” that might drive users with special use-cases crazy
  • an option to ignore certain files
    • complicates the interface
    • users need to identify all files they don’t like to trigger a rebuild
    • manual work
  • a combination of the last two
  • parse .gitignore and use that
    • pulp only seems to support git at the moment, so no code for e.g. mercurial necessary
    • might induce lots of overhead (or adhoc parsing)

A verbose option that displays all file changes should be added anyways (for easy debugging).

@hdgarrood
Copy link
Collaborator

I think I like the .gitignore option the best, provided that my memory serves correctly and the glob patterns it uses are not particularly difficult to parse and match with. I think we'd only need to provide functions parse :: String -> Maybe Pattern and match :: Pattern -> String -> Boolean to match one file path at a time. I'm also keen on having --verbose do that (see also #31, which is slightly different, but I'd like to have a --verbose option do both of these things).

@Profpatsch
Copy link
Contributor Author

The pattern format has a description here: https://git-scm.com/docs/gitignore#_pattern_format
One should refer to the git source code though when implementing.

There’s also hundreds of npm packages, probably of wildly varying quality: https://www.npmjs.com/search?q=gitignore

@Profpatsch
Copy link
Contributor Author

Profpatsch commented May 4, 2018

It looks like https://github.com/kaelzhang/node-ignore is a good implementation that is specific to .gitignore syntax and doesn’t have any dependencies.

Most similar packages seem to depend on minimatch (which has a very similar syntax to .gitignore, but:

Pay attention that minimatch does not work in the gitignore way. To filter filenames according to .gitignore file, I recommend this module.

@hdgarrood
Copy link
Collaborator

Yep, I’m happy to add a dependency on that.

@Profpatsch
Copy link
Contributor Author

I started work on this patch: master...Profpatsch:let-watch-honor-gitignore

@Profpatsch
Copy link
Contributor Author

Okay, I feel a bit dumb now, because there’s also git check-ignore which does the same, but maps 1:1 with the actual git algorithm. I think it is best to wrap that.
Of course that means invoking git for every change (at most once every 100 milliseconds, because of the debounce function). I’d add a debug message if a file is ignored because it is ignored by git.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants