Sublime Text 3在保存时删除我的PHP代码

时间:2017-04-11 09:52:28

标签: sublimetext3 sublimelinter

<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;

class AdminHomeController extends Controller
{
    public function index()
    {
      return view('AdminHome')->withPages(Page::all());
    }
}

当我按ctrL + s保存它时,会删除一些代码。我不知道为什么,你能给我一个解决方案吗?

<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;

class AdminHomeController extends Controller {
    public function index() {
        return view('AdminHome')->withPages(Page::all());
    }
}

代码变成这样。

我在下图中为我的sublime text 3安装了软件包。我认为它是由sublimeLinter引起的,但我不知道如何修复它,我的用户设置如下: enter image description here

{
    "user": {
        "debug": false,
        "delay": 0.15,
        "error_color": "D02000",
        "gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
        "gutter_theme_excludes": [],
        "lint_mode": "load/save",
        "linters": {
            "php": {
                "@disable": false,
                "args": [],
                "excludes": []
            },
            "phplint": {
                "@disable": false,
                "args": [],
                "excludes": []
            }
        },
        "mark_style": "outline",
        "no_column_highlights_line": false,
        "passive_warnings": false,
        "paths": {
            "linux": [],
            "osx": [],
            "windows": [
                "D:\\wamp64\\bin\\php\\php7.0.4"
            ]
        },
        "python_paths": {
            "linux": [],
            "osx": [],
            "windows": []
        },
        "rc_search_limit": 3,
        "shell_timeout": 10,
        "show_errors_on_save": false,
        "show_marks_in_minimap": true,
        "syntax_map": {
            "html (django)": "html",
            "html (rails)": "html",
            "html 5": "html",
            "javascript (babel)": "javascript",
            "magicpython": "python",
            "php": "html",
            "python django": "python",
            "pythonimproved": "python"
        },
        "warning_color": "DDB700",
        "wrap_find": true
    }
}

这是我第一次在本网站上提问,我来自中国,我的英语不是很好。

2 个答案:

答案 0 :(得分:3)

之前已向phpfmt个用户报告您的问题。在包settings-> phpfmt -> setting - User下,然后添加"passes": ["OnlyOrderUseClauses"]。看看this issue

更新:工作格式为"passes": "OnlyOrderUseClauses",,如@SHUIPING_YANG所述

答案 1 :(得分:0)

我遇到了同样的问题,但无法确切地知道为什么Sublime总是删除我的PHP use语句。此外,在尝试解决问题时,我意识到我的Sublime软件包与您已安装的软件包不同。期望一个,就是 SublimeCodeIntel 。我将其删除,然后按Ctrl + S,Sublime不再删除use语句。