VSCode 无法自动完成 Laravel 并且不显示所有语法错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45914910/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
VSCode can't autocomplete laravel and doesn't show all syntax errors
提问by Meteor Newbie
I am using VSCode with PHP IntelliSense. I also tried PHP Intelephense.
我正在将 VSCode 与 PHP IntelliSense 一起使用。我也试过 PHP Intelephense。
VSCode can't autocomplete things like Eloquent Model, Laravel Helpers etc. For Examle $this->hasMany()and a lot of other stuff related to laravel framework. VSCode can autocomplete php standard functions only. Also VSCode doesn't show me type errors like forgotten ">", for example $channel->threads()->latest()-get(); I lost already many hours with searching different typos. VSCode recognize standard typos only, like fogotten ";" "()".
VSCode 无法自动完成诸如 Eloquent 模型、Laravel 助手等内容。例如 $this-> hasMany()以及与 Laravel 框架相关的许多其他内容。VSCode 只能自动完成 php 标准功能。此外,VSCode 不会向我显示诸如忘记“ >”之类的类型错误,例如 $channel->threads()->latest() -get();我已经因为搜索不同的错别字而浪费了很多时间。VSCode 只识别标准的拼写错误,比如模糊的“ ;”“ ()”。
Are there any addons I can use to fix this problem? If not, are there other free editors that can autocomplete laravel functions and see typo errors that VSCode doesn't see?
我可以使用任何插件来解决这个问题吗?如果没有,是否有其他免费的编辑器可以自动完成 Laravel 函数并查看 VSCode 看不到的拼写错误?
回答by Troyer
You have a complete guide to prepare VSCodefor Laravel there.
你有一个完整的指南,准备VSCode为Laravel那里。
As a second option I highly recommend you Sublime Text 3because is flat, free to download, simple and fast, it have a lot of packages helping you to work with Laravel, like: Laravel 5 Snippets, Laravel Blade Highlighter, Blade Snippets...
作为第二个选择,我强烈推荐你Sublime Text 3,因为它是扁平化的、免费下载、简单和快速的,它有很多包可以帮助你使用 Laravel,例如:Laravel 5 Snippets、Laravel Blade Highlighter、Blade Snippets.. .
回答by Andre Fellows
You can also set php.suggest.basicto false to disable VS Code's built-in php code completion and avoid duplicate suggestions.
您还可以将php.suggest.basic设置为 false 以禁用 VS Code 的内置 php 代码完成并避免重复建议。
I found this after accessing Troyer's link and try to install the PHP Intelisense - Crane version.
我在访问 Troyer 的链接并尝试安装 PHP Intelisense - Crane 版本后发现了这一点。
After read the description (the extensios is out of market) but I have some others installed.
阅读说明后(扩展程序已售罄),但我安装了其他一些扩展程序。
When I set the configuration to false, only the scoped suggestions is showed.
当我将配置设置为 false 时,只显示范围内的建议。
I was looking for this help becaus when I am creating some Blueprint items, the suggestion brings me up all php functions and not those correlated to what I am doing...
我一直在寻找这个帮助,因为当我创建一些蓝图项目时,这个建议给我带来了所有的 php 函数,而不是那些与我正在做的事情相关的函数......
Sorry about my english...
对不起我的英语...
P.S. here are my installed extensions:
PS这里是我安装的扩展:
abusaidm.html-snippets
amiralizadeh9480.laravel-extra-intellisense
austenc.laravel-blade-spacer
austenc.laravel-docs
bmewburn.vscode-intelephense-client
calebporzio.better-phpunit
christian-kohler.path-intellisense
codingyu.laravel-goto-view
CoenraadS.bracket-pair-colorizer
ctf0.laravel-goto-controller
eamodio.gitlens
ecmel.vscode-html-css
felixfbecker.php-debug
formulahendry.auto-close-tag
humao.rest-client
mikestead.dotenv
ms-azuretools.vscode-docker
ms-vscode-remote.remote-containers
ms-vscode-remote.remote-ssh
ms-vscode-remote.remote-ssh-edit
ms-vscode-remote.remote-wsl
ms-vscode-remote.vscode-remote-extensionpack
neilbrayfield.php-docblocker
onecentlin.laravel-blade
onecentlin.laravel5-snippets
patbenatar.advanced-new-file
pflannery.vscode-versionlens
PKief.material-icon-theme
quicktype.quicktype
ryanluker.vscode-coverage-gutters
sleistner.vscode-fileutils
vscode-icons-team.vscode-icons