mason-null-ls

私はたぶん、Mimi おばさんの役割を引き継いだんだと思う。

So this is Christmas

And what have you done?

さあ クリスマスがやってきた

君にはどんな1年だった?

もう色々見透かされているとは思ってますが、 そんなものは気にせず、ど真ん中をぶっちぎります❗

mason-null-lsのお通りだー❗

mason-null-ls bridges mason.nvim with the null-ls plugin - making it easier to use both plugins together.

mason-null-lsmason.nvimnull-lsプラグインの橋渡しをします。

mason.nvimnull-ls (none-ls)も、とっても見覚えあるやつですね😉

Warning

このサイトの方針上、引用はそのまま載っ (以下略 ❗)

Another year over

And a new one just begun

今年ももう終わる

そして新しい年が始まるんだ

roppongi

Introduction

mason-null-ls.nvim closes some gaps that exist between mason.nvim and null-ls. Its main responsibilities are:

mason-null-ls.nvimmason.nvimnull-lsの間に存在するいくつかのギャップを埋めます。 主な役割は以下の通り:

  • provide extra convenience APIs such as the :NullLsInstall command
  • allow you to (i) automatically install, and (ii) automatically set up a predefined list of sources
  • translate between null-ls source names and mason.nvim package names (e.g. haml_lint <-> haml-lint)

It is recommended to use this extension if you use mason.nvim and null-ls. Please read the whole README.md before jumping to Setup.

  • NullLsInstallコマンドのような便利な API を提供する。
  • (i) 自動インストール、(ii) あらかじめ定義されたソースリストの自動セットアップ。
  • null-lsソース名とmason.nvimパッケージ名の変換 (例:haml_lint<->haml-lint)

mason.nvimnull-lsを使う場合はこの拡張機能を使うことを推奨します。 Setup に入る前に README.md を全て読んでください。

Note: this plugin uses the null-ls source names in the APIs it exposes - not mason.nvim package names.

このプラグインが公開する API では、mason.nvimのパッケージ名ではなくnull-lsのソース名を使用します。

And so this is Christmas

I hope you had fun

そう クリスマスがやってきたんだ

楽しんでいるかな

Requirements

これもやっぱり特に難しい要求はありませんが、 このサイトではnull-lsに代えて none-ls を使用していきます。

…ややこしいんですけども😮

The near and the dear ones

The old and the young

近くて 大切な人たち

お年寄りも 若者も

Installation

lazy.nvim

{
    "jay-babu/mason-null-ls.nvim",
    event = { "BufReadPre", "BufNewFile" },
    dependencies = {
      "williamboman/mason.nvim",
      "jose-elias-alvarez/null-ls.nvim",
    },
    config = function()
      require("your.null-ls.config") -- require your null-ls config here (example below)
    end,
}

configは次の項で行うとして、インストール部分を先に済ませてしまいましょう❗

extensions/init.lua

{
  'jay-babu/mason-null-ls.nvim',
  event = { 'BufReadPre', 'BufNewFile' },
  dependencies = {
    'williamboman/mason.nvim',
    'nvimtools/none-ls.nvim',
  },
},

null-ls.nvimnone-lsに変えるのを忘れないで😉

A very merry Christmas

And a happy New Year

Let’s hope it’s a good one

Without any fear

良い年でありますように

なにも心配ないよ

Automatic Setup Usage

Automatic Setup is a need feature that removes the need to configure null-ls for supported sources. Sources found installed in mason will automatically be setup for null-ls.

自動セットアップは、サポートされているソースに対して null-ls を設定する必要性を取り除く機能です。 mason にインストールされたソースは自動的に null-ls 用にセットアップされます。

例えば、それはもうめちゃくちゃ言語プロフェッショナルが扱う場合は、 handlersに個別に書いた方がきっちりできるはずです。

…ただ、そうでもない場合、言語ごとに一個一個の設定をしていかなきゃならないってなると、 mason.nvimが提供してくれるお手軽さが、かなり損なわれてしまいます。

でも、それではあまりにも勿体ないので、 これを理解した上で使用する分にはいいんじゃないかな〜って思うことにします❗そうします😆

And so happy Christmas (War is over)

For black and for white

For yellow and red ones

黒と白のために

黄色と赤だって

Let’s stop all the fight

すべての争いをやめよう

Example Config

require("mason").setup()
require("mason-null-ls").setup({
    handlers = {},
})

See the Default Configuration section to understand how the default configs can be overridden.

デフォルト設定を上書きする方法については、 Default Configurationセクションを参照してください。

このページではmasonsetup()はもう済んでいるものとして特に触れません。

その上で、ここもlazy.nvimをもっと頼って (怠けちゃって) いいと思います😪

lazy.nvimの提供するoptsオプションにパラメータを指定すると、そのままプラグインのconfig()に渡してくれます。

PropertyTypeDescription
optstable or fun(LazyPlugin, opts:table)opts should be a table (will be merged with parent specs), return a table (replaces parent specs) or should change a table. The table will be passed to the Plugin.config() function. Setting this value will imply Plugin.config()

なので、シンプルにこれだけで済ませてしまってもいいんじゃないかな😌

extensions/init.lua

{
  'jay-babu/mason-null-ls.nvim',
  event = { 'BufReadPre', 'BufNewFile' },
  dependencies = {
    'williamboman/mason.nvim',
    'nvimtools/none-ls.nvim',
  },
+ opts = {
+   handlers = {}
+ },
},

Default Configurationを見ての通り、 デフォルトではnilになっているので、これをArrayでオーバーライドしています。

Note

ぱっと見た感じ、handlersに対して「なんやこいつ😮」と思わなくもないんですが、これないと動かないでしょ❓

Usage

ここまでやれば、あとはMasonからインストールするだけでおっけーです❗

試しにstyluaを入れてみましょ😆

mason-stylua

Tip

Masonからも確認できますが、stylualua,luauFormatterですね。

それからluaを開いて、前回も出てきたvim.lsp.buf.formatを呼んでみれば…、

mason-none-ls-fidget

ここにパワーが溜まってきただろう❗❗

mason-none-ls-fidget2

そしてなんかいい感じにフォーマットされただろう⁉️

Note

このサイトでは、パワーを溜める様子を視覚化するために16.10. fidget.nvimにて鍛え上げました 💪😤

( If it does not work well… )

Warning

パワーが上手く溜まってこない場合はluaファイルを開いた状態で:LspInfoを確認してみてください。

mason-null-lspinfo

…もしClientnull-lsが認識されていなければ、それは “履 い て な い” んです、PAAAANTS!! 🤷‍♀️

急いでnone-ls.nvim まで戻って “履 い て” 来てください 👉🩲👈

War is Over

私事ではありますが、ちょっと時間がなくてLinterには全く触れられませんでした…😅

また落ち着いたらこのへんも含めて改めてやりましょ❗

去年もおんなじようなこと言っちゃっててかわいいですね❗❗ 下手しても失敗しても、未来で笑い飛ばせばいいんです❗❗ …はい、ごめんなさい🥹

ハッピークリスマス❗🍾 サンタさんも大喜びです🎅

愉しんできてね🤗

…あ❗もうおたのしみでしたか😸

WAR

IS

OVER!

IF YOU WANT IT
Happy Christmas from John & Yoko

War is over

戦争は終わる

If you want it

あなたがそう望むなら

War is over

戦争は終わった

Now

たった今

When Christmas Time is Over

When Christmas time is o'er,

クリスマスの時期が終わり…

And your bonnie clay is through,

君の愛しい手立てが終わったとき…

I'll be bristling to you people,

僕はみなさんに挨拶を贈ろう

All the best from me to you.

幸運を。 僕からあなたへ

When the beastie brags o' mutton

小さな獣が羊肉のご馳走にほくそ笑み…

To the heather in the glen,

谷間の杢藪へ向かう頃…

I'll be strutting out my tether

僕は束縛を振り解いて歩き出す

To your arms once back again.

もう一度 君の腕の中へ戻るんだ

Och away, ye bonnie.

さあおいで、愛しい人よ…