【问题标题】:VS Code on save trouble (React import)VS Code 上省事(React 导入)
【发布时间】:2022-07-05 12:53:52
【问题描述】:

我有反应文件:

import { CommonTableWithFilterViewDialogsProps, Dialogs } from 'app/views/modules/_common/components/CommonTableWithFilter/Dialogs';
import { ContextWatchState, TProcessProps } from 'app/views/modules/_common/components/CommonTableWithFilter/context/ContextStateValue';
import { TableView, TableViewProps } from 'app/views/modules/_common/components/CommonTableWithFilter/TableView';

import { FilterView } from 'app/views/modules/_common/components/CommonTableWithFilter/FilterView';
import { IReduxForm } from 'app/views/components/_hoc/withReduxForm';
import React from 'react';
import { SelectDataCommonDataModel } from 'app/web/common/data-models';
import { SortingKind } from 'app/common/enums';
import { hasComponentChangesFor } from 'app/common/functions';

保存反应文件导入后随机播放:

import { SortingKind } from 'app/common/enums';
import { hasComponentChangesFor } from 'app/common/functions';
import { IReduxForm } from 'app/views/components/_hoc/withReduxForm';
import { ContextWatchState, TProcessProps } from 'app/views/modules/_common/components/CommonTableWithFilter/context/ContextStateValue';
import { CommonTableWithFilterViewDialogsProps, Dialogs } from 'app/views/modules/_common/components/CommonTableWithFilter/Dialogs';
import { FilterView } from 'app/views/modules/_common/components/CommonTableWithFilter/FilterView';
import { TableView, TableViewProps } from 'app/views/modules/_common/components/CommonTableWithFilter/TableView';
import { SelectDataCommonDataModel } from 'app/web/common/data-models';
import React from 'react';

有没有办法解决这个问题?保存后我不需要更改任何内容。 我尝试在 Preferences => Settings 中禁用 'Format On Save',并更改了 'settings.json' 文件:

{
    "diffEditor.ignoreTrimWhitespace": false,
    "typescript.format.enable": false,
    "typescript.updateImportsOnFileMove.enabled": "never",
    "editor.formatOnSave": false,
    "editor.codeActionsOnSave": {
        "source.fixAll": false,
        "source.organizeImports": false,
        "source.sortMembers": false
    }
}

【问题讨论】:

    标签: visual-studio-code vscode-settings


    【解决方案1】:

    设置配置中有另一个属性对此负责。搜索 editor.codeActionsOnSave 并将 source.organizeImports 设置为 false。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-01
      • 1970-01-01
      • 1970-01-01
      • 2022-10-30
      • 2019-08-12
      • 2021-11-20
      • 2021-02-18
      • 1970-01-01
      相关资源
      最近更新 更多