Facebook 押注 VS Code


Facebook 近日宣布默认采用 VS Code 作为内部开发环境。


去年 Facebook 宣布 停止维护 其开源的 Nuclide/Atom-IDE,以及相关的一些库。

Nuclide/Atom-IDE 是 Atom 编辑器的功能包,其通过语言服务器协议与自定义语言服务器交互,为 Atom 提供一系列类似 IDE 的功能。功能包由各种“子包”组成,以单体扩展(atom-ide-ui)构建和发布。

虽然 Facebook 没有强制性限制内部开发者使用什么开发工具,比如一些开发者使用 Vim 与 Emacs,但是更多的开发者还是使用他们自家的 Nuclide/Atom-IDE,去年该工具停止开源维护,但是 Facebook 内部开发者继续在使用着它。到了年底,Facebook 对内部开发者宣布将从 Nuclide 迁移到 VS Code。

Facebook 介绍,为了将当前的 Nuclide 功能与新功能作为 VS Code 的内部扩展,Facebook 已经进行了大量开发工作。目前公司内部已经有大量开发者使用 VS Code。

而现在则更进一步,官方宣布将 VS Code 设置为 Facebook 的默认开发环境,并与微软合作,以帮助增强其远程开发扩展,使开发者能够进行大规模的远程开发

关于二者的合作,具体来看,Facebook 介绍,虽然当前开发者在电脑上本地安装 VS Code,但是大多数开发工作都是直接在其数据中心内单独预留的开发服务器上完成的。

以无缝并且高性能的方式访问这些服务器上的代码是十分必要的,所以 VS Code 远程开发扩展的能力至关重要,具体能够带来的好处是什么呢?

Facebook 认为与本地计算机上可用的硬件相比,这样可以使用更大、更快,或更专用的硬件来工作,为每个对象创建特定的专用环境项目的特定依赖项,而不必担心由于混合或冲突的配置而导致的错误,同时可以支持在多个运行中的开发环境之间快速切换而又不影响本地资源或工具性能的灵活性。

双方就各自在 VS Code 远程开发扩展与 Nuclide 远程开发研发上的经验和专业知识交换了意见。

而关于接下来的计划,Facebook 表示,随着内部迁移到 VS Code,其 Flow 语言现在正要积极改进语言服务协议(LSP)等方面,以更好地确保该语言与 VS Code 可以一起使用。

另一方面是源码控制也在跟进,Facebook 内部使用 Mercurial 作为其源码管理工具,相关的开发工作将继续扩展,以允许直接在 VS Code 中进行源码控制操作,从而使 Facebook 开发者能够适应所有工作流,对其代码进行审核与发布。

还有一点很重要,为什么选择了 VS Code 呢?Facebook 是这样说的:

“VS Code 是一种非常流行的开发工具,微软和开源社区对其提供了大量的投资和支持。VS Code 运行在 macOS、Windows 与 Linux 上,并具有健壮且定义明确的扩展 API,使我们能够继续构建公司进行的大规模开发所需的重要功能。VS Code 是一个我们可以安全地押注开发平台未来的平台。”

Facebook 公告


We’re making Visual Studio Code the default development environment at Facebook and teaming with Microsoft to help enhance their remote development extensions in an effort to enable engineers to do remote development at scale.


Facebook engineers have written millions of lines of code. There is no mandated development environment. Some developers use vim. Some use Emacs. And even more engineers use our internal, unified development environment called Nuclide.

Nuclide began as a set of open-source packages built on top of the Atom editor. We provided our engineers a set of functionality supporting its development workflow and the numerous programming languages used at the company. In 2018, we retired the open source version of Nuclide, but continued to use Nuclide internally.

In late 2018, we announced to our engineers that we would be moving Nuclide to Visual Studio Code. Plenty of development work has been done to migrate the current Nuclide functionality, along with some new features, as internal-facing extensions for Visual Studio Code. Visual Studio Code is now used extensively across the company in beta.

Why Visual Studio Code?

Visual Studio Code is a very popular development tool, with great investment and support from Microsoft and the open source community. It runs on macOS, Windows, and Linux, and has a robust and well-defined extension API that enables us to continue building the important capabilities required for the large-scale development that is done at the company. Visual Studio Code is a platform on which we can safely bet our development platform future.

Enhancing the Remote Development Experience

While engineers at Facebook have Visual Studio Code installed locally on laptops, most development is done directly on individually-reserved development servers that live within our data centers. Being able to access code on these servers in a seamless, performant way is critical for productivity.

As Microsoft’s Visual Studio Code team stated when they first released the remote extensions, remote development is an emerging trend. While our use cases may be more advanced than most development teams given our scale, any developer can gain the benefits of remote development:

  • Work with larger, faster, or more specialized hardware than what’s available on your local machine
  • Create tailored, dedicated environments for each project’s specific dependencies, without worrying about errors due to mixed or conflicting configurations
  • Support the flexibility of being able to quickly switch between multiple running development environments without impacting local resources or tool performance

These benefits should be available to any developer, and we at Facebook believe that we can apply our unique expertise in this problem space to help. That’s why today we are excited to share not just our usage of their remote development extensions, but our involvement in helping Microsoft further improve remote development extensions, with a lens on enabling engineers to do remote development at scale with Visual Studio Code.

To help Microsoft enhance its product offering, we have provided input through our experience and expertise supporting remote development for Nuclide. And Microsoft has now created such a robust remoting experience, it has allowed us to move off our own custom solution.

We’re also excited that the remote development capabilities added by Microsoft are available as extensions for anyone using Visual Studio Code.

Moving Forward

Given the scale of development at Facebook, supporting the efficiency and productivity of our engineers is key. Constant work is being done to enable Visual Studio Code to be the IDE of choice inside the company, whether by building extensions or enhancing our current technologies to better support it.

For example, when it comes to code, Facebook is a polyglot. Code is written in Python, C++, Java and in some of our own created languages like Flow, Hack and Reason. Extensions exist to support these languages, which include syntax highlighting, formatters, linters, etc. Flow, for example, has had a Facebook-developed public Visual Studio Code extension since 2015. With Facebook’s internal move to Visual Studio Code, Flow has been in active development, through areas like Language Service Protocol (LSP) improvements, to better ensure the language works great with Visual Studio Code.

Another example is around source control. Facebook uses Mercurial internally as its source control infrastructure. Development work continues on an extension to allow for source control manipulation directly within Visual Studio Code, enabling all of the workflows Facebook developers are comfortable with in order to get their code reviewed and landed.

Visual Studio Code is now an established part of Facebook’s development future. In teaming with Microsoft, we’re looking forward to being part of the community that helps Visual Studio Code continue to be a world class development tool.

Last modification:January 8th, 2020 at 12:50 am
If you find my article useful, please feel free to appreciate it.