twitter-bootstrap Webstorm 代码完成不显示引导类
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24726604/
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
Webstorm code completion does not show bootstrap classes
提问by Pascal
What do I have to change in my webstorm IDE that the bootstrap classes are recognized when I do:
我必须在我的 webstorm IDE 中更改哪些引导程序类在我这样做时被识别:
<a class="btn btn-primary" />
At the moment I have always to re-check the class names by looking into the bootstrap css files. Thats not so nice...
目前,我总是通过查看引导 css 文件来重新检查类名。那不是很好...
采纳答案by BuddhistBeast
Make sure it is turned on. Do the following in WebStorm:
确保它已打开。在 WebStorm 中执行以下操作:
File | Settings | IDE Settings | Editor - Code Completion
Or:
或者:
File | Settings | Type in the search bar "code completion"
The second option will take you straight to the code completion options if in some case you could not find it via the first way.
如果在某些情况下您无法通过第一种方式找到它,则第二个选项将带您直接进入代码完成选项。
More information can be found here
更多信息可以在这里找到
回答by J.J.
I had the same problem and finally fixed it!! You need to download the Bootstrap library LOCALLY.
我遇到了同样的问题,终于解决了!! 您需要在本地下载 Bootstrap 库。
This worked:
这有效:
<link rel="stylesheet" href="./css/css/bootstrap-theme.min.css" >
But this didn't work:
但这不起作用:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
Cheers, JJ
干杯,JJ
回答by Pranay Shirolkar
For a quick-fix, downloading the bootstrap.min.cssor whichever you are using locally, and then referencing it like
要快速修复,请下载bootstrap.min.css您在本地使用的或 任何一个,然后像这样引用它
<link href="stylesheets/bootstrap.min.css" rel="stylesheet">
solves the problem.
解决了这个问题。
I think another way for WebStorm to be able to autocomplete without referring to it locally would be to add the file as an external library
我认为 WebStorm 无需在本地引用即可自动完成的另一种方法是将文件添加为外部库
回答by eran otzap
For me the problem is the way i referenced the css files.
对我来说,问题是我引用 css 文件的方式。
My file structure :
我的文件结构:
Project
/App
-index.html
/bower_components
/bootstrap
/dist
/css
-bootstrap.css
and i referenced them like so :
我这样引用它们:
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="bower_components/bootswatch/superhero/bootstrap.min.css" />
The css was applied but no intellisence was provided. I think the css was applied due to my .bowerrc file.
应用了 css,但没有提供智能。我认为 css 是由于我的 .bowerrc 文件而应用的。
{
"directory": "bower_components"
}
I changed the path to the relative one and webstorm recognized my bootstrap classes.
我将路径更改为相对路径,webstorm 识别出我的引导程序类。
<link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="../bower_components/bootswatch/superhero/bootstrap.min.css" />
回答by Rajesh Meena
Finally I got the solution:
最后我得到了解决方案:
- Right click on style folder
- Mark directory as test sources root
- 右键单击样式文件夹
- 将目录标记为测试源根目录
回答by masoud amirian
If you are using style tag in your PHPpage, it prevents loading CSSclass code completion.
Put your styles into CSSfile then load it and remove style tag.
如果您在PHP页面中使用样式标记,它会阻止加载CSS类代码完成。
将您的样式放入CSS文件然后加载它并删除样式标签。
回答by antonkronaj
I had to mark my styles directory, which contains my css, as "Resources" in module settings. I also had to mark my bower components and node module directories as "Sources".
我必须在模块设置中将包含我的 css 的样式目录标记为“资源”。我还必须将我的凉亭组件和节点模块目录标记为“来源”。

