标签: intellij-plugin

我在哪里需要将UI初始化代码放在IntelliJ Idea插件中?

我想为IntelliJ Idea创建一个插件,它将一个小按钮放入状态栏.

AFAIK的代码必须如下所示:

final StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
final StatusBarWidget widget = new WordCounterWidget();
statusBar.addWidget(widget);
Run Code Online (Sandbox Code Playgroud)

WordCounterWidget是我想放入状态栏的按钮.

我试着说出来

  • 当我选择一个特定的菜单项时,调用一个被调用的动作
  • 进入项目服务的构造函数.

这些都没有带来预期的结果 - 按钮没有显示.

用于插入按钮的上述代码(或其他可显示文本且可点击的内容)是否正确?如果是的话,我应该把它放在哪里,以便在项目打开,重新打开或创建时执行它(状态栏小部件应该在Idea中打开项目时始终可见)?

代码在这里.

更新1:尝试将WordCounterServiceImpl的代码更改为

public class WordCounterServiceImpl implements WordCounterService {
    private final Project project;
    public WordCounterServiceImpl(final Project project) {
        this.project = project;
    }

    @Override
    public void projectOpened() {
        final StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
        final StatusBarWidget widget = new WordCounterWidget();
        statusBar.addWidget(widget);
    }
}
Run Code Online (Sandbox Code Playgroud)

该按钮仍未显示.

java intellij-idea intellij-plugin

7
推荐指数
1
解决办法
164
查看次数

IntelliJ IDEA - 如何为自定义语言插件启用拼写检查?

对于某些自定义语言插件,例如Markdown(扩展名为".md")和非Dairy Soy插件(扩展名为".soy"),IntelliJ拼写检查似乎被禁用,即使拼写错误也是如此.启用错字检查选项:

  • 流程代码
  • 处理文字
  • 处理评论

是否可以为自定义语言插件启用拼写检查?


更新:我已经为IntelliJ插件Non-Dairy-Soy-Plugin添加了拼写检查支持.请参阅分支拼写检查器下的拉请求Github上分叉副本.

spell-checking intellij-idea intellij-plugin google-closure-templates

6
推荐指数
1
解决办法
1570
查看次数

无法在IntelliJ IDEA中添加插件运行/调试配置

我想修改现有的IntelliJ IDEA插件,作为构建我自己的插件的一步.我选择了Front End Alignment,在IntelliJ IDEA中打开它,添加了IntelliJ Community Edition SDK,并成功构建了项目.但是当我尝试添加插件运行/调试配置(以验证我可以调试插件)时,"使用模块的类路径"下拉列表仅包含"[无]",我得到:

Run Configuration Error: No plugin module specified for configuration
Run Code Online (Sandbox Code Playgroud)

项目结构>项目设置>模块显示这front-end-alignment是一个已知模块.

如何在调试器中运行此示例插件?

intellij-idea intellij-plugin

6
推荐指数
0
解决办法
1925
查看次数

如何让 Intellij 选择代码完成建议而无需导航到它?

我正在使用带有 Ruby 插件的 IntelliJ IDEA 15.0.6。

我注意到当我用 Java 编写时,代码完成弹出窗口会自动突出显示第一个建议,如下所示 - 选中

这使我只需按“输入”即可完成单词并继续。

然而,当我用 ruby​​ 编写时,没有选择任何建议,就像这样 - 未选中的

这使得我必须使用箭头键导航,以便在我可以点击“输入”之前选择一个建议。

我尝试深入挖掘偏好和整个互联网,但我似乎无法找出为什么会发生这种情况。我尝试添加选项“通过键入点、空格等插入选定的变体”,但它不起作用,因为没有“选定的变体”

我知道这听起来很小,但它可怕地切断了我的工作流程,我相信还有其他人想知道如何做到这一点。

感谢任何能提供帮助的人

ruby intellij-idea code-completion intellij-plugin intellij-15

6
推荐指数
1
解决办法
384
查看次数

如何在 intellij Idea 中打开临时/预览选项卡

I like VS Code and sublime editor and in particular their default behaviour of preview the file. When you single click on a file from file explorer pan, it would open it in a temporary tab, unless a change is made in the file or opened with a double click on file, which opens it on persist tab.

Recently I've to use IntelliJ IDEA in a project and so far I like it this particular functionality is holding me up …

intellij-idea intellij-plugin intellij-idea-2016

6
推荐指数
1
解决办法
1630
查看次数

IntelliJ:运行单个方法,就像 BlueJ 那样

所以我目前使用 IntelliJ(2017-3,如果这很重要),但在我当前的项目中,我需要测试具有特定输入(主要是文本操作)的单个方法,所以我记得从学校回来的 BlueJ,在那里你可以创建对象并运行无需编写任何额外代码的单一方法。所以,我想知道,是否有插件或其他解决方法可以在 IntelliJ 中为我提供该功能?

(使用 BlueJ 并行破坏了 IntelliJ 的项目,所以这不是一个可悲的选择)

java intellij-idea intellij-plugin bluej

6
推荐指数
1
解决办法
3384
查看次数

如何在ideavim中为IntelliJ获取绝对和相对行号?

我正在为我的项目使用 IntelliJ IDE,并且刚刚安装了ideamvim 插件。在.ideavimrc我添加了这个属性

set rnu

有了这个属性,我在 intellij 的文件中得到了相对的行号,这太棒了。但我ALSO得到绝对的行号?在我的 vscode 中,我有绝对行号和相对行号,所以我想知道是否有可能在 intellij 中获得相同的行为?

即使我必须在 Intellij 中安装一个新插件才能使此功能正常工作,我也很好。

谢谢

vim intellij-idea intellij-plugin vim-plugin ideavim

6
推荐指数
4
解决办法
4105
查看次数

找不到键盘映射“Windows 正确重做”

pycharm 中出现一条消息

缺少键盘映射无法找到键盘映射“Windows 正确重做”

我不知道这个消息意味着什么以及如何解决。请帮忙

python plugins intellij-plugin pycharm

6
推荐指数
1
解决办法
6613
查看次数

从 Kotlin Psi API 检索继承类全名

我\xe2\x80\x99m 尝试开发一个codegen IDEA-Plugin。这个插件应该分析KtClass继承并获取所有继承类的全名(例如 com.example.config.TestConfig)

\n

我尝试通过查看 PsiViewer 来查找任何有用的信息。我发现KtClass的所有继承信息都存储在 中KtSuperTypeEntry,并且我尽力获取继承类的全名。

\n

上课Dest

\n
data class Dest(\n    val stringValue: String = "123",\n    override val stringConfig: String = "123",\n    override val iConfigStr: String = "123",\n    val b: B = B(),\n    val c: List<List<Set<Map<String, out Any?>>>> = listOf(),\n    val config: Config? = Config()\n) : Config()\n
Run Code Online (Sandbox Code Playgroud)\n
    \n
  1. superTypeListEntry.typeAsUserType.referenceExpression.getReferencedName() -return->"Config"
  2. \n
  3. superTypeListEntry.importReceiverMembers() -return->null
  4. \n
\n

看起来SuperTypeListEntry只包含继承类的简单名称信息。

\n

我还尝试通过 KtFile 查找继承类全名,但不知道继承类何时作为通配符在此 KtFile 中导入:

\n
fun KtSuperTypeListEntry.getType(ktFile: KtFile): String …
Run Code Online (Sandbox Code Playgroud)

compiler-construction intellij-plugin kotlin intellij-platform-psi

6
推荐指数
1
解决办法
817
查看次数

IntelliJ 是否有相当于 VS Code 'extensions.json' 建议?

最近我有时会使用 VS Code 和 IntelliJ。推荐扩展的 VS Code 功能非常适合项目的初始设置。

JetBrains 生态系统中是否有等效的插件?

jetbrains-ide intellij-idea intellij-plugin

6
推荐指数
1
解决办法
896
查看次数