为什么我不能从 CSS 文件中获取 CSS 类智能感知? [英] Why don't I get CSS class intellisense from CSS files?

查看:29
本文介绍了为什么我不能从 CSS 文件中获取 CSS 类智能感知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VS2012 的一个不错的功能是,当我编辑 HTML(或 .cshtml)文件时,它提供了很好的智能感知.

当我开始输入时:

Visual Studio 2013 RC 中的 HTML 编辑功能,这些问题似乎被触及,但更多的是针对VS2013 的发布候选或测试版.我正在使用 VS2013 Ultimate 12.0.21005.1 REL 以及我所知道的所有最新更新.

为什么 VS2013 在编写 href= 时不检测 CSS 文件以进行类自动补全,也不提示我输入 URL?

解决方案

这是 Visual Studio 2012 和 Visual Studio 2013 之间的变化.

以前,只需在 Visual Studio 2012 中打开一个文件(不是解决方案,只是一个 HTML 文件)并使用

在 HTML 文件中意味着 Visual Studio 将读取 CSS 文件内部并提供 CSS 类智能感知.微软放弃了这种方法,因为:

<块引用>

在动态包含文件或使用 ASP.NET Bundling 和 Minification 的情况下无法工作

[来源]

在 Visual Studio 2013 中,包含在您的项目/解决方案中的 CSS 文件现在将被自动解析,并且所有 HTML 文档都将获得 CSS 类智能感知.

One of the nice features of VS2012 was that when I'm editing an HTML (or .cshtml) file, it provided great intellisense.

When I start to type:

<a href="

The editor would open a prompt with "Pick URL..." and a list of possible options based on the current directory of the file.

^ Visual Studio 2012

Furthermore, in VS2012 the editor would detect any referenced CSS file(s), like this:

<link rel="stylesheet" type="text/css" href="bootstrap.css" />

And would provide autocompletion of all CSS classes inside that file.

So if I type:

<div class="

I would be prompted with all Bootstrap3 classes automatically. Like this:

^ Visual Studio 2012

However in VS2013 both of these features seem to be missing.

Now when I look for CSS classes I only get classes that I've already used inside the file:

^ Visual Studio 2013

According to the articles HTML Editing Features in Visual Studio 2013 Preview and HTML Editing Features in Visual Studio 2013 RC by Microsoft, these issues seem to be touched on but are more aimed at the Release Candidate or beta versions of VS2013. I'm using VS2013 Ultimate 12.0.21005.1 REL with all the latest update that I'm aware of.

Why is VS2013 not detecting CSS files for class autocompletion and not prompting me for URLs when writing href=?

解决方案

This was a change between Visual Studio 2012 and Visual Studio 2013.

Previously, simply opening a file in Visual Studio 2012 (not a solution, just an HTML file) and using

<link rel="stylesheet" href="bootstrap.css" />

in the HTML file meant that Visual Studio would read inside the CSS file and give CSS class intellisense. Microsoft abandoned this approach, because:

it failed to work in cases where files were included dynamically, or where ASP.NET Bundling and Minification was utilized

[Source]

In Visual Studio 2013, CSS files that are included in your project/solution will now automatically be parsed and all HTML documents will gain CSS class intellisense.

这篇关于为什么我不能从 CSS 文件中获取 CSS 类智能感知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆