在Scala编译错误中省略包名称

时间:2022-09-17 23:41:08

Our package names are quite long, and when you include the fact that there can be multiple type parameters in types mentioned in a type mismatch error, some of the compilation errors I get from scalac can be quite long, and it is annoying having to mentally skip over the package names in the error messages.

我们的包名很长,当你包含类型不匹配错误中提到的类型中可能存在多个类型参数的事实时,我从scalac获得的一些编译错误可能会很长,并且令人烦恼不得不在精神上跳过错误消息中的包名称。

Ideally I would like all identifiers to be displayed in the same way as they are in the corresponding source file (i.e. qualified if they are qualified, just simple names if they are not) but I realise this is probably too hard to achieve. So I would settle for just the option to hide the package names.

理想情况下,我希望所有标识符的显示方式与它们在相应的源文件中的显示方式相同(例如,如果它们是合格的,则是合格的,如果不是,则只是简单的名称)但我意识到这可能太难实现。因此,我会选择隐藏包名称。

I use ENSIME so it would be nice to be able to hide/show package names in compilation errors in ENSIME.

我使用ENSIME,因此能够在ENSIME中的编译错误中隐藏/显示包名称会很好。

1 个解决方案

#1


You need package names to avoid nonsense like

你需要包名来避免胡说八道

error: type mismatch
found   : Iterable[Int]
expected: Iterable[Int]

As an option, it sounds like it could be convenient. A patch would have a decent chance of being accepted, I expect.

作为一种选择,听起来可能很方便。我希望补丁有很大的机会被接受。

#1


You need package names to avoid nonsense like

你需要包名来避免胡说八道

error: type mismatch
found   : Iterable[Int]
expected: Iterable[Int]

As an option, it sounds like it could be convenient. A patch would have a decent chance of being accepted, I expect.

作为一种选择,听起来可能很方便。我希望补丁有很大的机会被接受。