Open megalithic opened 6 years ago
Could you share your project configuration files in a GitHub repo? I'll need to install and configure everything exactly as you did to repeat the bug.
@w0rp yes sir! thank you, i'll work on getting that to you. in the meantime, it looks like it's not just Ale, someone posted a similar issue with their SublimeText editor setup in the eslint-typescript-parser repo: https://github.com/eslint/typescript-eslint-parser/issues/463
I'll take a look at Ale's plugin fixer code and see if there is a way to disable writing that contents in OUTPUT STARTS
and OUTPUT ENDS
.
I believe I added support for a post-processing function for fixing files, so it might be possible to remove those lines from the output before writing them to the buffer.
hah, you read my mind; i was going to add something custom to my setup on buffer post-writing to deal with that scenario. your way is MUCH cleaner. :)
@w0rp this can be closed, setting a no-op for the loggerFn
property in your .eslintrc
does the trick. though it would be nice to do something with the ALEFixPost processor. thanks!
@w0rp unfortunately, that doesn't do the trick. while it does prevent the incompatibility warning from being logged (which means ale doesn't write it to the buffer now), problem is, the fixing works correctly only when that is logged to the buffer, when i add the .eslintrc
entry prescribed here: https://github.com/eslint/typescript-eslint-parser/issues/463#issuecomment-379396518, it no longer fixes on save as it did previously. However, it definitely does not write the incompatibility warning any longer.
So, I guess, I would love a small bit of direction for using that ALEFixPost
event, I see that I can setup the autocmd
, and want to do something like: au User ALEFixPost *.ts,*.tsx silent call RemoveTypescriptIncompatibilityBanner()
. Though to be honest, since the delimiters i'd be using to grep on are similar to merge conflict markers, I'm not sure of the best/cleanest way to go about removing that block of text.
Would love, love, love yours or another vim-master's input, prodding, direction, mentoring.
Thanks!
Have a look at autoload/ale/fixers/eslint.vim
for an example of the process_with
callback for fixers, and the documentation with :help ale-fix
. It should be possible to modify the prettier-eslint
fixer, or whichever one is at fault, so lines which look like those warning messages are removed. The callback receives the lines of output, and returns the modified lines of output.
@w0rp thanks! i'm giving it a go here: https://github.com/megalithic/ale/commit/d5cc4775fcb14daa49442092fcd26f5d84a7637e
I know it's not right/working, and in general way off.. I'm very much new to vimscript, so still learning about the <List>
primitive, etc. Though, pattern matching is nice.
It feels like I should check the first line in the list for matching and if it's a pattern similar to ====
, then we set a boolean that identifies us being in "unwanted output mode", then we loop the lines of output in that a:output
list, returning an empty list ([]
), per the eslint
fixer example, until we find the next pattern similar to ====
, unset that boolean and output as per normal.
Thoughts, is there a more idiomatic way to do the suggested above?
I've gone the easiest route and forked typescript-eslint-parser
and just disabled logging that version mismatch warning. Not optimal, but when I have more time to learn vimscript stuff to properly implement stripping of those messages, I'll get back to it. Hopefully someone else can take up the cause. :)
Information
VIM version
NVIM v0.2.2 Build type: Release
Operating System: macOS 10.13.3
:ALEInfo
What went wrong
Upon writing to the buffer, the fixer for
typescript
runs, which for me is['prettier', 'eslint', 'prettier_eslint']
, and the following is written to the top of the buffer that was written to:So, as you can see it literally wrote the contents of
OUTPUT STARTS
andOUTPUT ENDS
to the buffer.The fixer behavior, other than that, is exactly as expected. It is respecting my local
.eslintrc
, forprettier
+eslint
, akaprettier-eslint
.