clion设置HTML扩展,HTML

HTML

CLion brings powerful support for HTML that includes syntax and error highlighting, formatting according to the code style, structure validation, code completion, on-the-fly preview during a debugging session (Live Edit) or in the dedicated preview tab in the code editor, and much more.

HTML specification is configurable with the Default HTML language level preference on the Languages and Frameworks | Schemas and DTDs page of the Settings/Preferences Ctrl+Alt+S. By default, specification HTML 5.0 from W3C is assumed.Creating an HTML fileFrom the main menu, select File | New, and then select HTML File from the list. CLion creates a stub file based on the HTML file template and opens it in the editor.Creating references in an HTML file

Inside a , , or tag, CLion suggests completion for the path to the file you are referencing. 1e267bf1df4d4b1704bf45e176527680.png

Alternatively, in the Project tool window, select the JavaScript, CSS, or image file you want to reference and drag it into the HTML file. CLion generates the , , or tags inside

. For tags, CLion also generates the width and height attributes. 1679b85674daa8b91779719617f29e97.pngWrapping a code fragment in a tagSelect the code fragment to wrap and press Ctrl+Alt+T or select Code | Surround With from the main menu.

From the list, select Wrap with Tag. CLion encloses the selection in a pair of brackets (<> and > ).

Type the tag inside the opening brackets <>. CLion automatically fills in the tag in the closing brackets >. fbc65b1b2388ee21efe196cf1a378eb7.png

Learn more from Code generation.Documentation look-up

For most HTML tags and attributes CLion can show you a summary from the corresponding MDN article. This summary is displayed in the Documentation popup which also shows the deprecation status of a tag or an attribute and information on its compatibility with various browsers.

If the tag or the attribute is available in all versions of browsers, CLion does not show any information about its compatibility. 32a945220ec68f51c08eff3f5eed5997.png

Otherwise, the Documentation popup also lists the browsers and their versions that support the tag or the attribute. b33878ba5edf6ea1c8800e85f147b63a.pngCompatibility is checked only for Chrome, Chrome Android, Safari, Safari iOS, Firefox, Internet Explorer, and Edge.

If the tag or the attribute is deprecated, the popup also informs you about this status. ccde3cdaaab98606b9c6ca7bf5918b20.pngView documentation for a tag or an attribute Position the caret at the tag or the attribute and press Ctrl+Q or select View | Quick Documentation Lookup from the main menu.

When you hover the mouse pointer over a tag or an attribute, CLion immediately displays the reference for it in the Documentation popup.

You can turn off this behavior or configure the popup to appear faster or slower, see Configuring the behavior of Documentation popup below.Configure the behavior of Documentation popup To turn off showing documentation automatically, open the Settings/Preferences dialog Ctrl+Alt+S, go to Editor | Code Editing, and clear the Show quick documentation on mouse move checkbox.

To have the Documentation popup shown faster or slower, open the Settings/Preferences dialog Ctrl+Alt+S, go to Editor | General | Code Completion, then select the Show the documentation popup checkbox and specify the delay time.Open the MDN documentation for tags and attributes in the browser In the Documentation popup Ctrl+Q, click the link at the bottom.

Press Shift+F1 or select View | External Documentation from the main menu.Previewing output of an HTML file

You can open the output of your HTML code in the built-in CLion preview or externally, in a browser of your choice.

CLion opens the built-in preview in an editor tab, saves any changes you make to an HTML file or to the linked CSS and JavaScript files, and reloads the preview automatically. This makes your work faster as you no longer need to switch to the browser and refresh the pages. 95019023c2fe8b0b35d999727a21123f.pngOpen the CLion built-in preview From the main menu, select View | Open in Browser, and then select

clion.artwork.clion.svg Built-in Preview from the list.

Alternatively, hover your mouse pointer over the code to show the browser icons popup, and click

clion.artwork.clion.svg.

To make sure your HTML code is rendered properly in production environment, preview HTML files in specific browsers.Preview an HTML file in a browser From the main menu, select View | Open in Browser, and then select the desired browser from the list.

To open the CLion default browser, select Default.

Alternatively, hover your mouse pointer over the code to show the browser icons popup, and click the icon that indicates the desired browser:

icons.xml.browsers.chrome.svg

icons.xml.browsers.firefox.svg

icons.xml.browsers.safari.svg

icons.xml.browsers.edge.svg

icons.xml.browsers.opera.svg

If you have only one browser configured, just press Alt+F2.Configure the browser icons in the popup Open the Settings/Preferences dialog Ctrl+Alt+S and go to Tools | Web Browsers.

To hide some of the icons, clear the Active checkboxes for the unnecessary browsers.

To hide the whole popup, clear the For HTML files checkbox.Viewing HTML source code of a web page in the editorPress Ctrl+Shift+A and select Open Source Code from URL... from the list.

In the Open URL dialog that opens, type the URL address of the web page or choose a previously opened URL from the list.Viewing embedded imagesView images in CLion Select the image file in the Project tool window and press F4.

Alternatively, position the caret at the reference to the image in the editor and press Ctrl+B

To preview an image in a popup instead of in a separate tab, select the reference to it and press Ctrl+Shift+IView images in an external editor Select the image file in the Project tool window, and select Jump to external editor or press Ctrl+Alt+F4.

CLion opens the image in the editor that is used in your OS by default. You can configure another image editor in which the IDE will open files.Change the default external editor Right-click an image in the editor and select Edit Path to External Editor from the context menu.

You can also press Ctrl+Shift+A and type Edit Path to External Editor.

In the Path to External Editor dialog, specify the path to the application in which you want to open images and click Save. 1338f082b2f2c7d2f9f315ff676a3d4a.pngExtracting an include file

You can extract a fragment of HTML code into a separate include file. Entire JavaScript code blocks inside a tags can be extracted as well. CLion also suggests adding references instead of duplicates of the selected fragment.In the editor, select the code block to be extracted and choose Refactor | Extract | Extract Include File from the main menu or from the context menu of the selection.

In the Extract Include File dialog that opens, specify the name of the include file without the extension and the directory to store it in. You can accept the predefined directory or select another one.

Click OK, when ready. CLion extracts the selected source code into the specified file in the target directory and generates the corresponding reference in the source file.Configuring syntax highlighting

You can configure HTML-aware syntax highlighting according to your preferences and habits.In the Settings/Preferences dialog Ctrl+Alt+S, go to Editor | Color Scheme | HTML.

Select the color scheme, accept the highlighting settings inherited from defaults or customize them as described in Colors and fonts.

Last modified: 12 April 2021

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
c 环境配置 colin 主要包括三个步骤:安装编译器、配置环境变量和测试编译器。 首先,安装编译器。在安装 c 环境之前,我们需要先下载对应的编译器软件。常用的 c 编译器有 gcc、clang、MSVC 等。根据个人需求选择适合自己的编译器,并下载对应的安装包。然后,按照安装向导进行安装即可。安装完成后,我们就拥有了一个可用的 c 编译器。 接下来,配置环境变量。环境变量的配置可以使得我们在任意目录下都能够直接使用 c 编译器。首先,找到我们安装的编译器安装目录。然后,将该目录添加到系统的环境变量中。具体的配置步骤可以根据操作系统的不同而有所差异,但一般都是在控制面板或者系统设置中找到“环境变量”选项,然后添加编译器安装目录到系统的“PATH”变量中。配置完成后,我们就可以在任意目录下打开命令行终端,输入编译器命令来编译和运行 c 程序。 最后,测试编译器。经过以上两个步骤的配置,我们就可以测试我们的 c 编译器是否正常工作了。在任意目录下新建一个文本文件,将其后缀改为“.c”,比如“test.c”。然后,用任意文本编辑器打开该文件,输入一段简单的 c 代码,比如“#include <stdio.h> int main(){ printf("Hello, world!"); return 0; }”。保存文件后,回到命令行终端,进入该文件所在的目录,输入编译命令,如“gcc test.c -o test”,然后按回车键进行编译。如果没有出现错误信息,说明我们的 c 编译器已经成功配置。 综上所述,通过安装编译器、配置环境变量和测试编译器三个步骤,我们可以完成 c 环境的配置,从而能够顺利编译和运行 c 程序。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值