LightEdit mode光编辑模式
When you need to edit just one file without creating or loading the whole project in WebStorm, you can use the LightEdit mode.当您只需要编辑一个文件而不在WebStorm中创建或加载整个项目时,可以使用光编辑模式。

Keep in mind that the LightEdit mode works as a text-like editor, and it doesn't support the usual IDE editor features such as code completion, or code navigation. However, you can navigate to a specific line of code (Ctrl+G), fold or unfold parts of code, check, and change file encoding.请记住,LightEdit模式是一种类似文本的编辑器,它不支持常见的IDE编辑器功能,如代码完成或代码导航。但是,您可以导航到特定的代码行(Ctrl+G)、折叠或展开部分代码、检查和更改文件编码。
Open a file in the LightEdit mode在LightEdit模式下打开文件
You can use several ways to open a file in the LightEdit mode.可以使用多种方式在LightEdit模式下打开文件。
Open a file from the command line从命令行打开文件
-
Depending on your OS, open the file from the command line:根据您的操作系统,从命令行打开文件:webstorm.bat -e myfile.txtYou can find the executable script for running WebStorm in the installation directory under bin.您可以在bin下的安装目录中找到运行WebStorm的可执行脚本。To use this executable script as the command-line launcher, add it to your system要将此可执行脚本用作命令行启动器,请按照命令行界面中的说明将其添加到系统PATH
as described in Command-line interface.PATH
中。webstorm -e myfile.txt
有关为WebStorm创建启动程序脚本的信息,请参阅命令行界面。By default, WebStorm does not provide a command-line launcher.默认情况下,WebStorm不提供命令行启动器。For information about creating a launcher script for WebStorm, see Command-line interface.webstorm.sh -e myfile.txtYou can find the executable script for running WebStorm in the installation directory under bin.您可以在bin下的安装目录中找到运行WebStorm的可执行脚本。To use this executable script as the command-line launcher, add it to your system要将此可执行脚本用作命令行启动器,请按照命令行界面中的说明将其添加到系统PATH
as described in Command-line interface.PATH
中。
Open and edit a file with the wait switch使用等待开关打开并编辑文件
You can interrupt a process in the command line and put terminal on hold until you're done editing a file in the LightEdit mode. 您可以在命令行中中断进程,并将终端置于等待状态,直到您在光编辑模式下编辑完文件。For example, when you work in the command line and run a commit process to Git, you can pause the terminal and use a text editor in the LightEdit mode to quickly write a commit message.例如,在命令行中工作并对Git运行提交过程时,可以暂停终端并在LightEdit模式下使用文本编辑器快速编写提交消息。
-
Depending on your OS, open the file adding the根据您的操作系统,打开文件,在文件名之前添加-e
and-w
commands before the name of your file.-e
和-w
命令。webstorm.bat -e -w myfile.txtYou can find the executable script for running WebStorm in the installation directory under bin.您可以在bin下的安装目录中找到运行WebStorm的可执行脚本。To use this executable script as the command-line launcher, add it to your system要将此可执行脚本用作命令行启动器,请按照命令行界面中的说明将其添加到系统PATH
as described in Command-line interface.PATH
中。webstorm -e -w myfile.txtBy default, WebStorm does not provide a command-line launcher.默认情况下,WebStorm不提供命令行启动器。For information about creating a launcher script for WebStorm, see Command-line interface.有关为WebStorm创建启动程序脚本的信息,请参见命令行界面。webstorm.sh -e -w myfile.txtYou can find the executable script for running WebStorm in the installation directory under bin. To use this executable script as the command-line launcher, add it to your system
PATH
as described in Command-line interface.WebStorm opens the file in the LightEdit mode, and displays a notification indicating that the command line is waiting for the opened file to close.WebStorm以LightEdit模式打开文件,并显示一条通知,指示命令行正在等待打开的文件关闭。 -
Click one of the notification's options or close the file to release the command line.单击通知选项之一或关闭文件以释放命令行。
Work with code in the LightEdit mode在LightEdit模式下使用代码
Even though the LightEdit mode doesn't support all of the WebStorm editor coding assistance, you can still use basic editing features and basic menu options.即使LightEdit模式不支持所有WebStorm编辑器编码帮助,您仍然可以使用基本编辑功能和基本菜单选项。
-
Use the main menu to open recent files, show the line numbers, whitespaces, extend the code selection, and so on.使用主菜单打开最近使用的文件、显示行号、空格、扩展代码选择等。When you select Open File or Project dialog where you can quickly navigate to the opened file in the project's root directory.选择“文件”|“打开”时,WebStorm会打开“打开文件或项目”对话框,您可以在其中快速导航到项目根目录中打开的文件。 , WebStorm opens theClick the Select opened file icon on the toolbar.单击工具栏上的“选择打开的文件”图标。Note that for macOS, the native dialog will open.请注意,对于macOS,将打开本机对话框。When you edit a file, the blue color indication on the tab shows that the file content was changed.编辑文件时,选项卡上的蓝色指示显示文件内容已更改。 -
When external changes are made to the file you are working on, you can update it by selecting对正在处理的文件进行外部更改时,可以通过从主菜单中选择“文件”|“从磁盘重新加载”来更新该文件。 from the main menu. -
Use the context menu for pasting or folding your code as well as switching to column selection mode.使用关联菜单粘贴或折叠代码以及切换到列选择模式。 -
Use the status bar to go to the line you need, check the VCS, or toggle the Autosave mode.使用状态栏转到所需线路,检查VCS或切换自动保存模式。
Turn on autosave启用“自动保存”
-
Click Autosave: off on the Status bar and select the Save changes automatically in the popup that opens.单击状态栏上的“自动保存:关闭”,然后在打开的弹出窗口中选择“自动保存更改”。
Exit the LightEdit mode退出LightEdit模式
You can quit the LightEdit mode and switch from editing a single file to working on the entire project. 您可以退出LightEdit模式,从编辑单个文件切换到处理整个项目。To do so, use one of the following ways:为此,请使用以下方法之一:
Status bar状态栏-
On the status bar of the LightEdit mode, click Access full IDE and from the list of options, select how you want to proceed such as open the current file in the project, open the recent project, or open the new one.在“光编辑”模式的状态栏上,单击“访问整个DE”,然后从选项列表中选择继续操作的方式,例如打开项目中的当前文件、打开最近的项目或打开新文件。 Find action window“查找”操作窗口-
Press Alt+Enter and select Open file in project.按Alt+Enter并选择“在项目中打开文件”。 Main menu主菜单-
Select从主菜单中选择“文件”|“在项目中打开文件”。 from the main menu.