Code Monkey home page Code Monkey logo

lightline-ale's Introduction

lightline-ale

This plugin provides ALE indicator for the lightline vim plugin.

screenshot

Table Of Contents

Installation

Install using a plugin manager of your choice, for example:

call dein#add('dense-analysis/ale')       " Dependency: linter
call dein#add('itchyny/lightline.vim')    " Dependency: status line
call dein#add('maximbaz/lightline-ale')

Integration

  1. Register the components:
let g:lightline = {}

let g:lightline.component_expand = {
      \  'linter_checking': 'lightline#ale#checking',
      \  'linter_infos': 'lightline#ale#infos',
      \  'linter_warnings': 'lightline#ale#warnings',
      \  'linter_errors': 'lightline#ale#errors',
      \  'linter_ok': 'lightline#ale#ok',
      \ }
  1. Set color to the components:
let g:lightline.component_type = {
      \     'linter_checking': 'right',
      \     'linter_infos': 'right',
      \     'linter_warnings': 'warning',
      \     'linter_errors': 'error',
      \     'linter_ok': 'right',
      \ }
  1. Add the components to the lightline, for example to the right side:
let g:lightline.active = { 'right': [[ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_infos', 'linter_ok' ]] }

3.1. Lineinfo, fileformat, etc. have to be added additionaly. Final example:

let g:lightline.active = {
            \ 'right': [ [ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_infos', 'linter_ok' ],
            \            [ 'lineinfo' ],
	    \            [ 'percent' ],
	    \            [ 'fileformat', 'fileencoding', 'filetype'] ] }

Configuration

g:lightline#ale#indicator_checking

The indicator to use when ALE is in progress. Default is Linting....

g:lightline#ale#indicator_infos

The indicator to use when there are infos. Default is I:.

g:lightline#ale#indicator_warnings

The indicator to use when there are warnings. Default is W:.

g:lightline#ale#indicator_errors

The indicator to use when there are errors. Default is E:.

g:lightline#ale#indicator_ok

The indicator to use when there are no warnings or errors. Default is OK.

Using icons as indicators

If you would like to replace the default indicators with symbols like on the screenshot, then you'll need to ensure you have some "iconic fonts" installed, such as Font Awesome. A common alternative is to replace your primary font with one of the Patched Nerd Fonts, which saves you from having to install multiple fonts.

The following icons from the Font Awesome font are used in the screenshot:

  • Checking: f110
  • Infos: f129
  • Warnings: f071
  • Errors: f05e
  • OK: f00c (although I prefer to disable this component)

To specify icons in the configuration, use their unicode codes as "\uXXXX" (make sure to wrap them in double quotes). Alternatively copy the icons from a font website, or type <C-v>u<4-digit-unicode> or <C-v>U<8-digit-unicode> to insert the literal characters.

See the code points here:

Here's the configuration snippet used in the screenshot:

let g:lightline#ale#indicator_checking = "\uf110"
let g:lightline#ale#indicator_infos = "\uf129"
let g:lightline#ale#indicator_warnings = "\uf071"
let g:lightline#ale#indicator_errors = "\uf05e"
let g:lightline#ale#indicator_ok = "\uf00c"

License

Released under the ISC License

lightline-ale's People

Contributors

earnubs avatar infokiller avatar kozachynskyi avatar maximbaz avatar mphe avatar nargonath avatar neozenith avatar vancluever avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lightline-ale's Issues

Display 'ok' component only conditionally, otherwise it's misleading in some cases

Currently it appears the OK component seems to be displayed unconditionally, as a default status.
For instance, even in filetypes where ALE is not used (linter not available for the filetype), or not applicable (.txt file for instance).
I don't know if this is possible without underlying support from ALE, but it would be great if 'ok' component is displayed only when linting has actually successfully been done with zero warnings and errors? And not displayed at all if linting is not ever attempted/done. Or use a different indicator to say that linting is 'not applicable', for instance.
I just think that displaying 'ok' is a bit misleading in cases like these.

Questions on license

Hey! First of all, thanks for your plugin on integration between ALE and lightline, I have been using it for quite a long time now.

Now as I personally use neovim as my main vim editor, their LSP integration is quite good enough for my use case. So I'm seeking for an integration between native LSP from neovim with lightline. So far, I got nothing. Fortunately enough, neovim's documentations do have a section on how to get the information for that. And since I find your plugin's project structure to better suit the work I'm seeking, I have already start my project on these integration based on your work here so everyone else can reuse it.

So my version of the project for native LSP with lightline, so far I just have to change all function / variable names from lightline#ale#... to lightline#lsp#... and its implementation to a native LSP. And since everything is so perfect that I can just simply copy and update the name and its README, I wonder how should I credit you on this?

Let me know if you're happy if I can just simply clone and update your code to work with a new implementation and credit you. Otherwise, I can keep the work to myself.

[Bug] Lightline does not render the info

It just doesn't render anything new in the statusline. I've set all the configs according to instructions and it doesn't show anything on when it checks or not, nor does it show how many errors there are.

Overlapping patched font with text

The patched font seems to overlap with text when the errors/warnings are in hundreds (more than 3 digits)
Screen Shot 2020-06-04 at 9 06 04 AM

Can you also tell how to get the exact same appearance of the lightline as shown in the README screenshot?

Add Language Server to output

I am going to do some research on this because I think that this might need to be added to ALE, but I wanted to get a conversation started. I never really know if the language server is running or what the condition is. Would it be possible to configure this plugin to add Language Server health checks to its status?

Components do not render upon startup in JS files.

When opening a JS file with a pre-existing error/warning the lightline-ale components do not render. However, when I intentionally make an error said components pop up and remain.

The below gif demonstrates this.

ale_tsserver_delay

I am using eslint as a linter and tsserver as an LSP in ALE.

Show linting progress

Per this comment, ale#engine#IsCheckingBuffer(buffer_number) will return 1 when ALE is busy checking a buffer, and 0 otherwise.
I do currently use this as one of my personal/custom lightline components i.e.something like this below.

function! Lightline_GetAleStatus()
    if ale#engine#IsCheckingBuffer(bufnr('%'))
        return 'ALE in progress'
    else
        return ''
endfunction

But perhaps this can be folded into this plugin via a 'linter_in_progress' component, with an hour glass icon as an indicator?
Just a suggestion/feature request.
Thanks.

Issues with setting the correct color for warning and error

The plugin seems to have problems using the correct color for 'error' and 'warning'. It loads the stock colors and not the ones from my colorscheme. The error and warning colors seem to be correct elsewhere. Here's my colorscheme and .vimrc.

Edit: User error. I managed to miss that there was a duplicate "let g:lightline" in the .vimrc. Spent an hour troubleshooting before submitting, found the error 2 minutes after submitting this.

README screenshot configuration

Hello,

I've been using this plugin and it's working great. One question I have: The warning/error sections seem to absorb the rightmost section formatting. The picture in README looks correct. On my config, I don't get the brighter/bolder colors on the right like I do on the left.

I have the right side configured as per your instructions, as far as I can tell. Any ideas?

EDIT: I'm running VIM 8.1.401 on Ubuntu/WSL

screenshot

Show first error line number

First of all thanks for this plugin :)

So far it works great, I was wondering if in addition to showing the error count I could also display the first error line number:
screen shot 2018-06-22 at 13 43 30

As in maybe E: 1 L32

Unknown function: lightline#update

Hello,

I've installed lightline-ale package with Plug and when I launch vim or ALE linter runs, I keep on getting this error (it shows up and disappears after 1-2 seconds):

Error detected while processing User Auto commands for "ALELint":
E117: unknown function: lightline#update
Error detected while processing function 98_VimCloseCallback:
line 11:
E171: missing endif:

Any ideas on how to fix it? Thanks!

lightline-ale breaks goyo

When using goyo, saving causes lightline to reappear. I've narrowed it down to lightline-ale by disabling other plugins.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.