Skip to content

Instantly share code, notes, and snippets.

@hrsh7th
Last active December 9, 2020 15:12
Show Gist options
  • Save hrsh7th/46ffe9f4e04cfd29d1e5d281a957fa32 to your computer and use it in GitHub Desktop.
Save hrsh7th/46ffe9f4e04cfd29d1e5d281a957fa32 to your computer and use it in GitHub Desktop.
sample
local lapi = require'lapi'
local SELECTOR = {
markers = { 'package.json' },
filetypes = { 'javascript', 'typescript', 'javascript.jsx', 'typescript.tsx' },
}
lapi.extensions.register('eslint', {
is = function(document)
return document.is(SELECTOR)
end,
activate = function(extension)
assert(vim.loop.exepath('eslint'), 'should install eslint for your path.')
extension.attach(lapi.completion.register('eslint', {
is = function(document)
return document.is(SELECTOR)
end,
metadata = function()
end,
datermine = function()
end,
complete = function()
end,
resolve = function()
end,
}))
extension.attach(lapi.workspace.on_text_document_did_open(function(event)
local document = event.document
if not document.is(SELECTOR) then
return
end
end))
return extension
end,
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment