HN user

olafurpg

8 karma
Posts2
Comments5
View on HN

I'm an engineer on the code intel team at Sourcegraph. You can try out compiler-accurate code navigation here https://sourcegraph.com/github.com/sourcegraph/sourcegraph@2... See "Go to definition" and "Find references".

The general idea is that you should be able to navigate your codebase online with Sourcegraph similar to how you would navigate the code with a local IDE (IntelliJ, VS Code). The benefits of Sourcegraph become more pronounced once the size of the codebase grows, especially across multiple repositories, and you're working with a large team of developers.

The main difference between the two is that BSP serves the needs of language servers and LSP serves the needs of editors. The two protocols have some duplicated functionality like build/publishDiagnostics (== LSP textDocument/publishDiagnostics), build/logMessage (== LSP window/logMessage), build/showMessage (== LSP window/showMessage), build/didChangeWatchedFiles (== LSP workspace/didChangeWatchedFiles).

There are some methods in BSP that might merit inclusion in LSP like buildTarget/test and buildTarget/run.

However, there are some critical methods in BSP that make no sense in LSP like buildTarget/scalacOptions. This is a method to extract dependencies and other compiler flags that are necessary for a Scala language server to provide completions, navigation, etc. Currently, every Scala IDE builds its own "export" command for each supported build tool resulting in duplicated effort. With BSP, we hope that a build tool can implement the server once and in return get integrations for multiple IDEs.

Scala Center 10 years ago

I'm the author of scalafmt, happy to hear there's interest in the project! Scala has a very rich syntax. I remember first coding in Scala being unsure where to put newlines or how far to indent. My hope is to make that problem go away.

Scalafmt is indeed new, just released 0.1.0 last week. However, it's already become useful for me with the IntelliJ plugin. Scalafmt is practically my full-time job for 2 more months so you can expect it to get more mature soon. Feature requests and bug reports are very welcome.