简体   繁体   English

F#交互式自动完成

[英]F# Interactive autocomplete

是否有任何选项可以在 VS2010 中的 F# 交互中自动完成?

No. The best way to write code interactively in F# is to create a new script file and write all code in the script file (where you get all the autocompletion and background type checking).不可以。在 F# 中交互式编写代码的最佳方法是创建一个新的脚本文件并在脚本文件中编写所有代码(您可以在其中进行所有自动完成和后台类型检查)。 Then you just select code and hit Alt+Enter to evaluate it in F# Interactive window.然后,您只需选择代码并按 Alt+Enter 即可在 F# 交互窗口中对其进行评估。

The F# service running in Visual Studio has a method that returns declarations (see source code ), so it would be possible to add IntelliSense to F# Interactive eg in MonoDevelop.在 Visual Studio 中运行的 F# 服务有一个返回声明的方法(请参阅源代码),因此可以将 IntelliSense 添加到 F# Interactive(例如在 MonoDevelop 中)。 However, I think most of the people write code in the main editor, so this is not so frequent request...不过,我想大部分人都是在主编辑器里写代码的,所以这个要求不是那么频繁……

There is a visual studio extension here: https://github.com/vlasenkoalexey/FSharp.Interactive.Intellisense这里有一个 Visual Studio 扩展: https : //github.com/vlasenkoalexey/FSharp.Interactive.Intellisense

It doesn't work as good as the c# interactive intellisense but it can be a good start.它不像 c# 交互式智能感知那么好用,但它可以是一个好的开始。

Aleksey Vlasenko made F# Interactive Intellisense for VS2013 and VS2015. Aleksey Vlasenko 为 VS2013 和 VS2015 制作了F# Interactive Intellisense It knows about any variables/functions you create in FSI.它知道您在 FSI 中创建的任何变量/函数。 My biggest gripe is that it doesn't display documentation or the type signatures我最大的抱怨是它不显示文档或类型签名

Well, you get autocompletation by pressing TAB key.好吧,您可以通过按 TAB 键来自动完成。

open S[TAB] will write System and so on打开 S[TAB] 会写 System 等等

It should be ON by default.默认情况下它应该是ON。

For more info see:有关更多信息,请参阅:

fsi.exe --help fsi.exe --help

or run或运行

fsi.exe --readline+ fsi.exe --readline+

VS 2015, Community edition VS 2015,社区版

No autocomplete in the console, but more annoying no reliable autocomplete in the editor.控制台中没有自动完成功能,但更烦人的是编辑器中没有可靠的自动完成功能。

The only way that seems to remotely work is to actually have a .fs instead of .fsx in another project and set-up the dependencies, this way F12 to navigate to the rest of your solution works, and you get the same level of auto-complete etc that the other projects.似乎远程工作的唯一方法是在另一个项目中实际使用 .fs 而不是 .fsx 并设置依赖项,这样 F12 导航到解决方案的其余部分工作,并且您获得相同级别的自动-完成等其他项目。

Don't forget to comment or exclude the new project before you compile, otherwise you might have some possibly dangerous scripts executing out of nowhere..在编译之前不要忘记注释或排除新项目,否则您可能会突然执行一些可能危险的脚本。

Interestingly C# interactive, which is a total copy of F# interactive has auto-complete.有趣的是 C# 交互,它是 F# 交互的完整副本,具有自动完成功能。 So it seems a bit far fetched, but at some point - if C# interactive starts to resemble like something usable, maybe use it on your F# project and be done with the frustration.所以这似乎有点牵强,但在某些时候 - 如果 C# 交互式开始像一些可用的东西,也许可以在您的 F# 项目中使用它并完成挫败感。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM