Плагины для webstorm как установить
Перейти к содержимому

Плагины для webstorm как установить

  • автор:

Install plugins

Plugins extend the core functionality of WebStorm. For example, install plugins to get the following features:

  • Integration with version control systems, issue trackers, build management servers, and other tools.
  • Coding assistance support for various languages and frameworks.
  • Shortcut hints, live previews, File Watchers, and so on.
  • Coding exercises that can help you to learn a new programming language.

By default, WebStorm includes a number of bundled plugins. You can disable bundled plugins, but they cannot be removed. You can install additional plugins from the plugin repository or from a local archive file (ZIP or JAR).

Open plugin settings

The Plugins settings dialog

  • Press Control+Alt+S to open the IDE settings and then select Plugins .

Use the Marketplace tab to browse and install plugins from JetBrains Marketplace or from a custom plugin repository.

Use the Installed tab to browse bundled and installed plugins, enable, disable, update, or remove them. Disabling unnecessary plugins can increase performance.

If a plugin depends on some other plugin, you can find a list of the dependencies in the Additional Info tab. If your project depends on certain plugins, add them to the list of required plugins.

Install plugin from Marketplace

  1. Press Control+Alt+S to open the IDE settings and then select Plugins .
  2. Click the Marketplace tab and type the plugin name in the search field.
  3. To install the plugin, click Install and restart WebStorm.

To install a specific version, go to the plugin page in JetBrains Marketplace, download and install it as described in Install plugin from disk. For example, you can do it if the most recent version of the plugin is broken.

Install plugin from disk

Install Plugin from Disk

  1. Download the plugin archive (ZIP or JAR).
  2. Press Control+Alt+S to open the IDE settings and then select Plugins .
  3. On the Plugins page, click and then click Install Plugin from Disk… .
  4. Select the plugin archive file and click OK .
  5. Click OK to apply the changes and restart the IDE if prompted.

Install plugin from command line

Plugin ID

  1. Quit the IDE on which you want to install the plugin.
  2. From JetBrains Marketplace page, find the page of the required plugin, select the Versions tab, and click any version to copy pluginId . pluginId is a short name of the plugin you want to install. For example, dev.blachut.svelte.lang .
  3. Install the plugin:

Navigate to the bin directory under your WebStorm installation directory and run the following command:

webstorm64.exe installPlugins
For example:
webstorm64.exe installPlugins tanvd.grazi
Run the following command:
open -na «WebStorm.app» —args installPlugins
For example:
open -na «WebStorm.app» —args installPlugins tanvd.grazi

Navigate to the bin directory under your WebStorm installation directory and run the following command:

webstorm.sh installPlugins
For example:
webstorm.sh installPlugins tanvd.grazi

Remove plugin

You cannot remove bundled plugins.

Uninstall plugin

  1. Press Control+Alt+S to open the IDE settings and then select Plugins .
  2. Open the Installed tab and find the plugin that you want to remove.
  3. Expand the Disable list and select Uninstall .

Disable plugin

You can disable a plugin without removing it if you do not need the corresponding functionality.

Disabling an installed plugin

  1. Press Control+Alt+S to open the IDE settings and then select Plugins .
  2. Open the Installed tab, find and select the plugin that you want to disable.
  3. On the plugin’s description pane, click Disable . Alternatively, you can use the checkboxes in the list of plugins or the Disable all buttons for plugin categories.

You can disable or enable all manually installed plugins at once (non-bundled) in the menu under .

Disable all downloaded plugins

Required plugins

A project may require plugins that provide support for certain technologies or frameworks. You can add such plugins to the list of required plugins for the current project, so that WebStorm will verify that the plugins are installed and enabled. It will notify you if you forget about some plugin, or someone on your team is not aware about the dependency as they work on the project.

Add a required plugin for your current project

Add required plugin dialog

  1. Make sure the required plugin is installed.
  2. Press Control+Alt+S to open the IDE settings and then select Build, Execution, Deployment | Required Plugins .
  3. On the Required Plugins page, click and select the plugin. Optionally, specify the minimum and maximum version of the plugin.

To specify the required version of WebStorm itself, add IDE Core to the list of required plugins.

The list of required plugins is stored in the .idea/externalDependencies.xml file of your project. When you open the project in WebStorm, it will notify you if the required plugin is disabled, not installed, or requires an update.

Required plugin is disabled

Click the link in the notification message to quickly enable, install, or update the required plugin.

Suggested plugins

When you open a project, WebStorm can suggest installing and enabling plugins based on libraries used in your project. Do not confuse suggested plugins with required plugins that you can manually add to a project so that your teammates also use it.

For more information about the criteria for suggesting plugins, refer to the JetBrains Marketpalce documentation.

If you don’t need a particular plugin, you can prevent WebStorm from suggesting it. You can also use your notification settings to disable or enable notifications of all plugin suggestions and the way they are displayed.

Disable suggestions of a plugin

  • When a notification of a suggested plugin appears, click Don’t suggest again .

Next time when you open a project, WebStorm will not suggest this plugin.

Check a project for suggested plugins

You can check your project for suggested plugins except for plugins for which you have disabled suggestions.

Check suggested plugins

  1. Press Control+Shift+A and start typing Check Suggested Plugins .
  2. Select the Check Suggested Plugins action.
  3. If WebStorm has a plugin applicable to your project, you’ll see the notification message. Click the link in the notification message to install or enable the suggested plugin.

Alternatively, you can open the IDE settings ( Control+Alt+S ) and go to Plugins | Marketplace : If there are plugins suggested for your project, they will be displayed on top of the plugin list, in the Suggested section.

Suggested plugins

Custom plugin repositories

By default, WebStorm is configured to use plugins from JetBrains Marketplace. This is a public repository where everyone can host their plugins. However, if you develop plugins for internal use only, you can set up a custom plugin repository for them.

For more information about setting up a custom plugin repository, see the IntelliJ Platform SDK documentation.

Once you set up your plugin repository, add it to WebStorm:

Add custom repositories

  1. Press Control+Alt+S to open the IDE settings and then select Plugins .
  2. On the Plugins page, click and select Manage Plugin Repositories… . The Manage plugin repositories menu
  3. In the Custom Plugin Repositories dialog, click and specify your repository URL. It must point to the location of the XML file that describes your plugin, for example, updatePlugins.xml . The file can be on the same server as your custom plugins, or on a dedicated one. How to add a custom plugin repository
  4. Click OK in the Custom Plugin Repositories dialog to save the list of plugin repositories.
  5. Click OK in the Settings dialog to apply the changes.

When you search for plugins, WebStorm will show you results both from default JetBrains Marketplace and any custom repositories that you specify. To browse only a certain custom plugin repository, type repository: followed by the URL of the repository in the search field on the Marketplace tab of the Plugins page. For example:

repository:http://plugins.example.com:8080/updatePlugins.xml myPlugin

Alternatively, you can add your custom plugin repositories using the idea.plugin.hosts property:

  1. Go to Help | Edit Custom Properties .
  2. Add the idea.plugin.hosts property to the platform properties file and specify the URL of the XML file that describes your plugin. For example:

idea.plugin.hosts=»http://plugins.example.com:8080/updatePlugins.xml»

You may want to replace default JetBrains Marketplace with your custom plugin repository. This can be helpful if you want only your custom repository plugins to be available from WebStorm.

Replace the default plugin repository

  1. Go to Help | Edit Custom Properties .
  2. Add the idea.plugins.host property to the platform properties file and specify the URL of the application that can properly handle requests from WebStorm, that is, act as the default plugin repository application instead of JetBrains Marketplace. In particular, it should handle the following requests:
    • Get the list of plugins
    • Download the latest plugin update
  3. Restart WebStorm.

If you replace the default plugin repository, the search field on the Marketplace tab of the Plugins dialog will browse only the plugins in the new default repository and any custom repositories that you add.

Productivity tips

Filter and sort search results

  • Type a forward slash / in the search string to see options for filtering and sorting search results. For example, you can add the following options to your search string to list only language-related plugins and sort them alphabetically by name:

Sublime Text

Плагин доступен для установки из Package Control по названию WebFont.

Вызов плагина осуществляется клавишами Ctrl+Alt+F.

Обновление списка шрифтов автоматически.

Поддерживаются Sublime Text >= 3.

Visual Studio Code

Установить плагин можно из списка плагинов в редакторе: File > Preferences > Extensions > Webfont. После установки перезапустить редактор.

Запуск плагина из контекстного меню или Command Palette

Обновление списка шрифтов автоматически.

WebStorm

Установить плагин можно из списка плагинов в редакторе: File > Settings > Plugins. После установки перезапустить редактор.

Вызов плагина осуществляется клавишами Ctrl+Alt+F.

Обновление списка шрифтов автоматически.

Поддерживаются WebStorm и PhpStorm.

Install plugins from the command line

Install plugins by plugin ID from the JetBrains Marketplace or a custom plugin repository.

Installing plugins means putting them in the plugins directory. If you run this command on a fresh WebStorm installation, the IDE will not suggest importing the settings from the previous installation when you launch it for the first time, because the settings will no longer be empty.

You can find the executable for running WebStorm in the installation directory under bin . To use this executable as the command-line launcher, add it to your system PATH as described in Command-line interface.

webstorm64.exe installPlugins [repository-url . ] webstorm64.exe installPlugins tanvd.grazi

Install a plugin with the ID com.example.myplugin from a custom repository http://plugins.example.com:8080/updatePlugins.xml :

webstorm64.exe installPlugins com.example.myplugin http://plugins.example.com:8080/updatePlugins.xml

By default, WebStorm does not provide a command-line launcher. For more information about creating a launcher script for WebStorm, refer to Command-line interface.

webstorm installPlugins [repository-url . ] webstorm installPlugins tanvd.grazi

Install a plugin with the ID com.example.myplugin from a custom repository http://plugins.example.com:8080/updatePlugins.xml :

webstorm installPlugins com.example.myplugin http://plugins.example.com:8080/updatePlugins.xml

You can find the script for running WebStorm in the installation directory under bin . To use this script as the command-line launcher, add it to your system PATH as described in Command-line interface.

webstorm.sh installPlugins [repository-url . ] webstorm.sh installPlugins dev.blachut.svelte.lang

Install a plugin with the ID com.example.myplugin from a custom repository http://plugins.example.com:8080/updatePlugins.xml :

webstorm.sh installPlugins com.example.myplugin http://plugins.example.com:8080/updatePlugins.xml

The developer of the plugin specifies a unique identifier for the plugin in plugin.xml – the plugin configuration file. If it is a public plugin, you can find its ID on the page of the plugin in JetBrains Marketplace. On the Versions tab, click the relevant version to view the plugin ID and other details.

Плагин для webstorm и авто-дополнение

Хотелось бы поделиться простым способом добавить недостающее авто-дополнение в IDE семейства IDEA. В нашем случае к WebStorm или PhpStrom.

У нас на проекте на фронте используется библиотека require.js. И при работе с ней нужно указывать пути к тем или иным файлам что бы добавить их в зависимости. К сожалению пути к этим файлам приходиться писать руками или копировать по частям.
И я подумал что это нужно бы исправить, и добавить авто дополнение пути до файлов.

После этого я начал искать информацию как писать плагины к Idea и вспомнил о статье хабраюзера zenden2k, в которой он рассказывал как сделать плагин для разрешения ссылок для kohana. Перед прочтением моей статьи обязательно нужно её прочитать.

Решив что разрешение ссылок тоже очень полезный функционал, я для начала написал плагин именно для этого.
При написании плагина я столкнулся с проблемой отсутствия PSI структуры для javascript файлов в Idea Community Edition, а без этого было не возможно определить структуру файла JS, которая нужна для определения нужного элемента для разрешения ссылки. Мне пришлось поставить себе Idea Ultimate EAP. В Idea UT нужно поставить плагин для Javascript, и тогда в PSI Viewer (Tools ->View PSI Structure) будет доступен выбор PSI структуры для Javascript файлов.

Скриншот

image

Так же в связи с тем что со времени написания той статьи JetBrains выкатили openapi для PHP и JS, я использовал привязку уже к конкретному PSI элементу JSLiteralExpression. Мой PsiReferenceContributor стал выглядеть так:

RequirejsPsiReferenceContributor.java

package requirejs; import com.intellij.lang.javascript.psi.JSLiteralExpression; import com.intellij.patterns.StandardPatterns; import com.intellij.psi.PsiReferenceContributor; import com.intellij.psi.PsiReferenceRegistrar; public class RequirejsPsiReferenceContributor extends PsiReferenceContributor < @Override public void registerReferenceProviders(PsiReferenceRegistrar psiReferenceRegistrar) < RequirejsPsiReferenceProvider provider = new RequirejsPsiReferenceProvider(); psiReferenceRegistrar.registerReferenceProvider(StandardPatterns.instanceOf(JSLiteralExpression.class), provider); >> 

Как видно вместо PsiElement.class я уже использовал конкретно JSLiteralExpression.class, что бы не приходилось обрабатывать все подряд элементы.
Но для того что бы можно было использовать openapi нужно подключить его в проекте плагина в idea. Для этого нужно зайти в Project Structure, там выбрать Libraries. Нажимаем на + над центральной колонкой, выбираем Java и в открывшемся окне выбора файла выбираем файл «/path_to_webstrom/plugins/JavaScriptLanguage/lib/javascript-openapi.jar»:

Скриншот

image

Потом переходим к Modules, открываем вкладку Dependencies, и там на против javascript-openapi указываем Scope как Provided:

Скриншот

image

После этих манипуляций IDE будет подсказывать названия классов и других вещей что входят в openapi для javascript.

Так же нужно было изменить PsiReferenceProvider, избавив его от рефлексии, вышло примерно так:

RequirejsPsiReferenceProvider.java

package requirejs; import com.intellij.ide.util.PropertiesComponent; import com.intellij.lang.javascript.psi.JSCallExpression; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiReference; import com.intellij.psi.PsiReferenceProvider; import com.intellij.util.ProcessingContext; import org.jetbrains.annotations.NotNull; public class RequirejsPsiReferenceProvider extends PsiReferenceProvider < @NotNull @Override public PsiReference[] getReferencesByElement(@NotNull PsiElement psiElement, @NotNull ProcessingContext processingContext) < Project project = psiElement.getProject(); PropertiesComponent properties = PropertiesComponent.getInstance(project); String webDirPrefString = properties.getValue("web_dir", "webfront/web"); VirtualFile webDir = project.getBaseDir().findFileByRelativePath(webDirPrefString); if (webDir == null) < return PsiReference.EMPTY_ARRAY; >try < String path = psiElement.getText(); if (isRequireCall(psiElement)) < PsiReference ref = new RequirejsReference(psiElement, new TextRange(1, path.length() - 1), project, webDir); return new PsiReference[] ; > > catch (Exception ignored) <> return new PsiReference[0]; > public static boolean isRequireCall(PsiElement element) < PsiElement prevEl = element.getParent(); if (prevEl != null) < prevEl = prevEl.getParent(); >if (prevEl != null) < if (prevEl instanceof JSCallExpression) < try < if (prevEl.getChildren().length >1) < if (prevEl.getChildren()[0].getText().toLowerCase().equals("require")) < return true; >> > catch (Exception ignored) <> > > return false; > > 

Далее необходимо реализовать метод отвечающий за разрешение данной ссылки.
И вот тут у меня возник затык связанный с очень скупой информацией о написании плагинов к idea. Дело в том что изначально у меня было желание начинать поиск файлов от директорий помеченных как «Resource Root», но увы я не смог найти как можно получить такие директории. Поэтому решил брать путь до директории из настроек, для чего реализовал страницу настройки как в описано в статье zenden2k, поэтому не буду повторяться.
После того как мы узнали директорию в которой нам нужно искать файлы по пути, всё было просто. У класса VirtualFile есть метод findFileByRelativePath, который принимает на вход строку пути, и ищет существует ли файл по данному пути и есть да, то возвращает его как экземпляр VirtualFile класса. Так что нужно было взять значение строки из PsiElement, вырезать лишнее, добавить недостающее и проверить существует ли такой файл. Если существует, то просто вернуть ссылку на него в виде экземпляра PsiElement. Метод resolve выглядит так:

RequirejsReverence.java::resolve()

 @Nullable @Override public PsiElement resolve() < String path = element.getText(); path = path.replace("'", "").replace("\"", ""); if (path.startsWith("tpl!")) < path = path.replace("tpl!", ""); >else < path = path.concat(".js"); >if (path.startsWith("./")) < path = path.replaceFirst( ".", element .getContainingFile() .getVirtualFile() .getParent() .getPath() .replace(webDir.getPath(), "") ); >VirtualFile targetFile = webDir.findFileByRelativePath(path); if (targetFile != null) < return PsiManager.getInstance(project).findFile(targetFile); >return null; > 

Сделав это я получил разрешение ссылок и можно было приступать к реализации авто-дополнения.

В idea есть два способа реализовать авто-дополнение. Первый простой, это реализовать метод getVariants интерфейса PsiReference, и второй продвинутый использовать CompletionContributor. Я в попробовал оба способа, но каких-то преимуществ в CompletionContributor, для себя не нашёл, поэтому остановился на использовании первого способа.
Для авто-дополнения нам нужно возвращать список элементов в виде массива. Это может быть массив со строками, LoookupElement или PsiElement.
В начале я попробовал возвращать строки. Но тут меня ждал сюрприз. Дело в том что idea строки со слешами вставляет после последнего слеша всю строку. При этом если выдавать строку только со значением после слеша, то idea не воспринимает эту строку как подходящую для авто-дополнения. Это поведение мне не совсем понятно. И найти информацию о том как правильно сделать авто-дополнения строк со слешами или как вариант с путями для файлов мне не удалось.
По этому сделал по своему.
Для того что бы самому управлять вставкой значения нужно реализовать интерфейс InsertHandler и в нем в методе handleInsert произвести необходимые действия. А что бы его использовать нужно возвращать не просто строку, а LookupElement, в котором будет нужный нам InsertHandler.
Так что я расширил класс LookupElement, таким образом:

RequirejsLookupElement.java

package requirejs; import com.intellij.codeInsight.completion.InsertHandler; import com.intellij.codeInsight.completion.InsertionContext; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull; public class RequirejsLookupElement extends LookupElement < String path; PsiElement element; private InsertHandlerinsertHandler = null; public RequirejsLookupElement(String path, InsertHandler insertHandler, PsiElement element) < this.path = path; this.insertHandler = insertHandler; this.element = element; >public void handleInsert(InsertionContext context) < if (this.insertHandler != null) < this.insertHandler.handleInsert(context, this); >> @NotNull @Override public String getLookupString() < return path; >>

Реализация InsertHandler выглядит так:
RequirejsInsertHandler.java

package requirejs; import com.intellij.codeInsight.completion.InsertHandler; import com.intellij.codeInsight.completion.InsertionContext; import com.intellij.codeInsight.lookup.LookupElement; public class RequirejsInsertHandler implements InsertHandler < private static final RequirejsInsertHandler instance = new RequirejsInsertHandler(); @Override public void handleInsert(InsertionContext insertionContext, LookupElement lookupElement) < if (lookupElement instanceof RequirejsLookupElement) < insertionContext.getDocument().replaceString( ((RequirejsLookupElement) lookupElement).element.getTextOffset() + 1, insertionContext.getTailOffset(), ((RequirejsLookupElement) lookupElement).path ); >> public static RequirejsInsertHandler getInstance() < return instance; >>

Суть метода handleInsert в том что мы берём lookupElement получаем PsiElement для которого он был показан и выбран, из PsiElement мы получаем его местоположение в файле и заменяем текстом из lookupElement.path всю длинну строки элемента. Конечно это не лучший способ, но к сожалению другого я найти не смог.

После этого я сделал поиск всех подходящих файлов, и возвращал их в виде массива LookupElement.
Вот полный листинг RequirejsReference:

RequirejsReference.java

package requirejs; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.newvfs.impl.VirtualDirectoryImpl; import com.intellij.openapi.vfs.newvfs.impl.VirtualFileImpl; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiManager; import com.intellij.psi.PsiReference; import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; public class RequirejsReference implements PsiReference < PsiElement element; TextRange textRange; Project project; VirtualFile webDir; public RequirejsReference(PsiElement element, TextRange textRange, Project project, VirtualFile webDir) < this.element = element; this.textRange = textRange; this.project = project; this.webDir = webDir; >@Override public PsiElement getElement() < return this.element; >@Nullable @Override public PsiElement resolve() < String path = element.getText(); path = path.replace("'", "").replace("\"", ""); if (path.startsWith("tpl!")) < path = path.replace("tpl!", ""); >else < path = path.concat(".js"); >if (path.startsWith("./")) < path = path.replaceFirst( ".", element .getContainingFile() .getVirtualFile() .getParent() .getPath() .replace(webDir.getPath(), "") ); >VirtualFile targetFile = webDir.findFileByRelativePath(path); if (targetFile != null) < return PsiManager.getInstance(project).findFile(targetFile); >return null; > @Override public String toString() < return getCanonicalText(); >@Override public boolean isSoft() < return false; >@NotNull @Override public Object[] getVariants() < ArrayListfiles = filterFiles(this.element); ArrayList completionResultSet = new ArrayList(); for (int i = 0; i < files.size(); i++) < completionResultSet.add( new RequirejsLookupElement( files.get(i), RequirejsInsertHandler.getInstance(), this.element ) ); >return completionResultSet.toArray(); > protected ArrayList getAllFilesInDirectory(VirtualFile directory) < ArrayListfiles = new ArrayList(); VirtualFile[] childrens = directory.getChildren(); if (childrens.length != 0) < for (int i = 0; i < childrens.length; i++) < if (childrens[i] instanceof VirtualDirectoryImpl) < files.addAll(getAllFilesInDirectory(childrens[i])); >else if (childrens[i] instanceof VirtualFileImpl) < files.add(childrens[i].getPath().replace(webDir.getPath() + "/", "")); >> > return files; > protected ArrayList filterFiles (PsiElement element) < String value = element.getText().replace("'", "").replace("\"", "").replace("IntellijIdeaRulezzz ", ""); Boolean tpl = value.startsWith("tpl!"); String valuePath = value.replaceFirst("tpl!", ""); ArrayListallFiles = getAllFilesInDirectory(webDir); ArrayList trueFiles = new ArrayList(); String file; for (int i = 0; i < allFiles.size(); i++) < file = allFiles.get(i); if (file.startsWith(valuePath)) < if (tpl && file.endsWith(".html")) < trueFiles.add("tpl!" + file); >else if (file.endsWith(".js")) < trueFiles.add(file.replace(".js", "")); >> > return trueFiles; > @Override public boolean isReferenceTo(PsiElement psiElement) < return false; >@Override public PsiElement bindToElement(@NotNull PsiElement psiElement) throws IncorrectOperationException < throw new IncorrectOperationException(); >@Override public PsiElement handleElementRename(String s) throws IncorrectOperationException < throw new IncorrectOperationException(); >@Override public TextRange getRangeInElement() < return textRange; >@NotNull @Override public String getCanonicalText() < return element.getText(); >>

Я выделил метод поиска файлов отдельно, так как он рекурсивный, и так же выделил метод фильтрации файлов, так как для темплейтов нужны только html, а для остального нужны js файлы. Так же при вставке темплейты вставляются вместе с префиксом tpl!, а js файлы вставляются без расширения js.

UPD:
В комментариях, пользователь VISTALL, подсказал что создание собственного класса наследника LookupElement было лишним. Вместо этого можно использовать LookupElementBuilder, который позволяет указать какой какой insertHandler использовать и к какому PsiElement он относится.
Для использования LookupElementBuilder, я изменил метод RequirejsReference::getVariants, следующим образом:

RequirejsReference::getVariants

 @NotNull @Override public Object[] getVariants() < ArrayListfiles = filterFiles(element); ArrayList completionResultSet = new ArrayList(); for (int i = 0; i < files.size(); i++) < completionResultSet.add( LookupElementBuilder .create(element, files.get(i)) .withInsertHandler( RequirejsInsertHandler.getInstance() ) ); >return completionResultSet.toArray(); > 

Что бы сгенерированный LookupElement знал к какому PsiElement он относится, достаточно вызвать метод create, первым параметром передав PsiElement, а вторым строку, которую нужно использовать для авто-дополнения.
Так же я изменил сам RequirejsInsertHandler::handleInsert так:

RequirejsInsertHandler::handleInsert

 @Override public void handleInsert(InsertionContext insertionContext, LookupElement lookupElement)

Из него я убрал проверку на тип lookupElement и использовал методы для получения PsiElement и строки для замены.
После этих манипуляций, класс RequirejsLookupElement, более не нужен.

UPD 2:
Плагин слегка допилен и выложен на github: github.com/Fedott/WebStormRequireJsPlugin
Тае же плагин теперь доступен в официальном репозитории jetbrains: plugins.jetbrains.com/plugin/7337
Хотелки можно отправлять писать на github или здесь.

На этом всё.
Есть есть вопросы или советы как лучше реализовать, буду рад их прочесть.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *