zyedidia / micro

A modern and intuitive terminal-based text editor

Home Page:https://micro-editor.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot install linter -- Unknown plugin

shmitchel opened this issue · comments

Description of the problem or steps to reproduce

I can't seem to install the linter:

Through the command line

$ micro -plugin install linter
Unknown plugin "linter"

Through command mode

$ micro
// type <ctrl-e>
> plugin install linter
Unknown plugin "linter"

Specifications

Version 2.0.14-dev.185
Commit hash 9176508
Compiled May 21, 2024
OS PureOS
Terminal Tilix

Attempts to fix

Manual Install

I've tried installing the linter manually to ~/.config/micro/plug by cloning the repo and copying the relevant directory:

$ tree ~/.config/micro/plug/linter
/home/guy/.config/micro/plug/linter/
├── help/
│   └── linter.md
└── linter.lua

Copy linter to repo

I've tried adding the linter to a personal repository, tagged it, set up the repo.json, and then added that repository to my configs:
~/.config/micro/channel.json

[
  ...
    // linter plugin
  "https://raw.githubusercontent.com/shitchell/micro-linter/v1.0.0/repo.json"
]

~/.config/micro/settings.json

{
  ...
  "pluginrepos": ["https://raw.githubusercontent.com/shitchell/micro-linter/main/repo.json"],
  ...
}

And this does let me install it! When I run micro -plugin install linter, it fetches the zip and installs it to ~/.config/micro/plug. But... it still doesn't do anything. I tried adding a basic linter in my init.lua:
~/.config/micro/init.lua

function init()
    linter.makeLinter("typescript", "ts", "tsc", {"--noEmit"}, "%f:%l:%c:.+: %m")
end

And when I launch micro, it gives me the following error:

$ micro
Plugin initlua: init:2: attempt to index a non-table object(nil) with key 'makeLinter'
stack traceback:
        init:2: in main chunk
        [G]: ?

Press enter to continue

Using micro -debug registers nothing related except for a line saying that the "linter" plugin is overridden.:

$ micro -debug
$ cat log.txt
2024/07/02 09:47:47 Micro started
2024/07/02 09:47:47 linter built-in plugin overridden by user-defined one

And that's only when I use the cloned linter plugin. In other scenarios, I only get the "Micro started" line.

Attaching all configured settings/JSON files

bindings.json
channel.json
settings.json

For whatever it's worth, other plugins work perfectly fine :) I've got aspell, filemanager, manipulator, & wc all installed and running flawlessly.

The linter plugin is builtin so it is not in the official plugin channel and it does not have to be installed, but builtin plugins can be overriden. There was an error about linter being nil in init.lua because the plugin was not loaded. The plugin was not loaded because linter option is set as false in settings.json.

There have been other people that tried installing builtin plugins but there is an error printed about plugins already being installed if they are not builtin only. I have not checked if it has been reported or fixed in a pull request.

The linter plugin is builtin so it is not in the official plugin channel and it does not have to be installed, but builtin plugins can be overriden. There was an error about linter being nil in init.lua because the plugin was not loaded. The plugin was not loaded because linter option is set as false in settings.json.

There have been other people that tried installing builtin plugins but there is an error printed about plugins already being installed if they are not builtin only. I have not checked if it has been reported or fixed in a pull request.

I... am closing this ticket. Holy cow. I've struggled with this for months and never noticed that setting in my settings.json 😂 THANK YOU SO MUCH!