microsoft / microsoft/TypeScript-Sublime-Plugin

Auto-format after save doesn't work correctly on files opened after load

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

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

主要言語
JavaScript
スター
1.7k
フォーク
236
平均マージ
21日 13時間
マージ済み PR(30日)
1

説明

I'm using Sublime build 4113, under linux (Lubuntu 18.04)

I've customized https://github.com/microsoft/TypeScript-Sublime-Plugin/blob/master/typescript/libs/editor_client.py#L110 by adding these options:

        format_options = {
            "tabSize": self.tab_size,
            "indentSize": self.indent_size,
            "convertTabsToSpaces": self.translate_tab_to_spaces,
            "insertSpaceAfterFunctionKeywordForAnonymousFunctions": True,
            "typescript.format.InsertSpaceAfterFunctionKeywordForAnonymousFunctions": True,
            "javascript.format.InsertSpaceAfterFunctionKeywordForAnonymousFunctions": True
        }

If I open a file modify it and save, the formatting works but doesn't respect these settings, so it'll format like this:

const fn = function(arg) { }

but then, if I close and reopen Sublime Text modify the file and save again, the formatting works correctly

const fn = function (arg) { }

Is there something I'm doing wrong? I know it's maybe hacky the way I modified my ~/.config/sublime-text-3/Packages/TypeScript/typescript/libs/editor_client.py setting directly

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

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

調査の方向性

typescrip​​t/libs/editor_client.py の 110 行目付近から始め、新しく開いたファイルと Sublime Text の再起動後に再度開いたファイルとのフォーマットの違いを再現してください。フォーマットオプションがいつ初期化または適用されるかを追跡し、エディターを再起動せずに最初の保存時から設定したスペース幅が尊重されれば、issue は完了とみなします。

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

評価

技術スタック
javascript, python, typescript
領域
devtools
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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