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

Add OCaml support with ocamlformat #154

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

adamyi
Copy link

@adamyi adamyi commented Jul 7, 2020

No description provided.

@adamyi
Copy link
Author

adamyi commented Jul 7, 2020

It seems that the failed tests are unrelated to this cl, but in prettier and clang-format. The ocamlformat vroom tests passed :)

Copy link
Contributor

@dbarnett dbarnett left a comment

Choose a reason for hiding this comment

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

Thanks! And thanks for bearing with me on delays getting it reviewed!

let l:fname = expand('%:p')
if !empty(l:fname)
let l:cmd += ['--name', l:fname]
let l:fname_pattern = '"' . escape(l:fname, '\') . '"'
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider defining this closer to the usage. Currently it looks really fishy doing all this escaping and concatenation without any hints what it's used for until much further down.

let l:matchidx = 1
while 1
let l:tokens = matchlist(v:exception,
\ '\vFile ' . l:fname_pattern . ', line (\d+), characters (\d+)-\d+:\n(.*)\n', 0, l:matchidx)
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of the double indirection matching the output using (1) a pattern built from (2) a dynamic variable, could you just do a looser match for anything that looks like "filename or " and skip any that don't match? This seems like it could be brittle if e.g. paths may be absolute/relative, or have any trivial extra characters like "./".

TruncatedDinoSour pushed a commit to TruncatedDinoSour/vim-codefmt that referenced this pull request Jan 15, 2022
Signed-off-by: Ari Archer <truncateddinosour@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants