How to use configuration found in `.rustfmt.toml` when running Rust format?

オープン
#503 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
35/100
issue の種類
ドキュメント
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
vim

調査の方向性

Read the rust.vim configuration and formatting documentation to determine how rustfmt options are passed and whether .rustfmt.toml is discovered from a parent directory. The issue gives no file or test entry point, so first locate the documentation or code that handles rustfmt_options. Done means documenting a working setup that applies the stated imports_layout configuration.

索引モデルが issue の本文から書いたものです。

説明

  • rust.vim version: Whatever comes automatically by including "rust-lang/rust.vim" in my plugins.lua file
  • nvchad distro of Neovim.

Steps to reproduce:

In my plugin directory I currently have:

  {
    "rust-lang/rust.vim",
    ft = "rust",
    init = function ()
      vim.rustfmt_options = "+nightly"
      vim.g.rustfmt_autosave = 1
    end
  },

This is working inasmuch as it's reformatting my code on save.

However, it's ignoring the configurations I have set in the .rustfmt.toml in the parent directory.

For example:

imports_layout = "Vertical"

should result in the imports being stacked, but the formatting from rust.vim is undoing that.

Expected vs. actual behavior:

This isn't a bug as much as a gap in my knowledge. I'd hope to find a solution that recognizes my .rustfmt.toml and includes the configuration. Perhaps I could include a lua script that checks if it exists and includes it in the rustfmt_options?

主要言語
Vim Script
スター
4.2k
フォーク
323
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rust-lang/rust.vim のほかの issue

rust-lang/rust.vim の issue をすべて見る

似ている issue

DevTools の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。