如何让 Scala 编译器插件在 Scala IDE 中工作
注意:这是 Scala-IDE 邮件列表上同一问题的精确转发,我在 5 天后得到了零答复并放弃了等待。
我正在编写一个 Scala 编译器插件。目前它被称为 scalawrapper(但我以后可能会找到更好的名字)。我有 安装了 Typesafe Stack,并将我的插件放在下面:
C:\Program Files\typesafe-stack\misc\scala-devel\plugins
现在我可以像这样调用 scalac:
scalac -classpath ... -Xplugin-require:scalawrapper test\...
它会自动查找并使用我的插件。
不幸的是,我无法让 Scala-IDE 使用它。我总是得到 缺少必需的插件:scalawrapper
。在“项目属性 \Scala Compiler(使用项目设置)\Advanced”选项卡,我已输入 Xplugin-require 字段中的 scalawrapper ,并且它有效,因为我得到 错误。但我在 Xpluginsdir 中输入的任何内容似乎都没有 影响。
我已经尝试过上面给出的绝对路径,也尝试过转发 和反斜杠,已尝试使用不带空格的临时目录 在其中,已经尝试过相对于项目目录,已经尝试过相对 到工作区。它只是不会使用任何东西。我还应该注意到 is 不是特定于我自己的插件,因为我尝试使用 ScalaCL 之前版本的 Scala-IDE 中的插件,并且失败 完全相同的原因。
我今天刚刚更新(2011 年 10 月 15 日),所以应该有最新的 版本(看来我终于可以明确地将缩进设置为4, 但也许我只是忽略了过去的设置)。
有人可以告诉我它实际期望什么,以及它的用途是什么 当我没有在 Xpluginsdir 中放置任何内容时默认吗?
Note: This is an exact repost of the same question on the Scala-IDE mailing list, where I got zero reply and gave up waiting after 5 days.
I'm writing a Scala Compiler Plugin. It's currently called
scalawrapper (but I might find a better name later). I have the
Typesafe Stack installed, and I put my plugin in it under:
C:\Program Files\typesafe-stack\misc\scala-devel\plugins
Now I can call scalac like this:
scalac -classpath ... -Xplugin-require:scalawrapper test\...
and it finds and uses my plugin automatically.
Unfortunately, I just can't get the Scala-IDE to use it. I always getMissing required plugin: scalawrapper
. In the "Project Properties
\Scala Compiler (Use Project Settings)\Advanced" tab, I have entered
scalawrapper in the Xplugin-require field, and that works, since I get
the error. But nothing I can type in Xpluginsdir seem to have any
effect.
I have tried the absolute path given above, have tried with forward
and backward slashes, have tried a temporary directory without spaces
in it, have tried relative to project directory, have tried relative
to workspace. It just will not use anything. I should also note that
is is not specific to my own plugin, as I tried to use the ScalaCL
plugin before in a previous version of the Scala-IDE, and failed for
the exact same reason.
I have just updated today (15.10.2011) and so should have the latest
version (it seems I can finally explicitly set the indentation to 4,
but maybe I just overlooked the setting in the past).
Can someone tell me what it actually expects, and what is uses as
default when I don't put anything in Xpluginsdir?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Scala IDE 使用演示编译器,而不是您已安装的编译器。要在 Scala IDE 中使用插件,您需要在 Eclipse 的首选项中指定它。
尝试
Windows->首选项->Scala->编译器
。请参阅“高级”选项卡。这些路径是相对于工作空间的。编辑:当我说相对于工作区时,我指的是存储 .metadata 的实际工作区目录(
$workspace_loc
)。我有一个项目,其中包括源代码的项目文件存储在一个目录中,工作区位于其他位置,即$project_loc
(c:\code\project\source) 与$workspace_loc
(c:\code\project\workspace)。您在编译器参数中指定的目录是相对于工作区 ($workspace_loc
) 的。要了解您是否有类似的设置,请转到项目并选择
Properties->Resource->Linked Resources
。我在
$workspace_loc
下创建了一个名为plugin 的目录,并将 jar 文件放置在其中。在Windows->Preferences->Scala->Compiler
Advanced 选项卡下,我有请注意,您也可以在项目属性中指定插件,但它仍然使用
$workspace_loc< /代码>。上面的配置对我有用。
The Scala IDE uses the presentation compiler, not the compiler that you've installed. To use a plugin, with Scala IDE, you need to specify it in the preferences in Eclipse.
Try
Windows->Preferences->Scala->Compiler
. See the Advanced tab. The paths are relative to the workspace.EDIT: When I say relative to the workspace, I mean the actual workspace directory under which the .metadata is stored (
$workspace_loc
). I have a project where project files including the source code is stored in one directory and the workspace is elsewhere, i.e the$project_loc
(c:\code\project\source) is different from the$workspace_loc
(c:\code\project\workspace). The directory that you specify in the compiler parameters is relative to the workspace ($workspace_loc
).To find out if you have a similar setup, go to the project and select
Properties->Resource->Linked Resources
.I created a directory under
$workspace_loc
called plugin and placed the jar file in there. UnderWindows->Preferences->Scala->Compiler
Advanced tab I havePlease note that you can specify the plugin in the project properties as well, but it still uses
$workspace_loc
. The above configuration works for me.