question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add explicit resolution capabilities to bsp

See original GitHub issue

buildTarget/dependencySources is one of the most important requests in BSP. dependencySources allows language servers to manage dependencies’ indices and provide language features like syntax highlighting, code navigation and autocompletions. These features are supported for both the projects of a build and the library dependencies (when you go to the definition of a method in a library, you want to be able to go to definitions of its body).

To achieve this full experience, IDEs extract all source/doc jars of the build via their custom integrations (think sbt, maven or gradle integrations in IntelliJ) and index the source code. This is a slow process that makes the “import project” experience poor. When developers clone projects and import them, the process can take easily more than 10 minutes because the build tool needs to download all jars (whose size can be in the order of GB for a medium-sized Scala project).

All Scala developers that want to contribute to a library for the first time need to go through this expensive process. I’ve noticed that in my case I’ve tried hard to avoid cloning projects locally and preferred making changes via the github interface to avoid the wait, but ultimately made the contributing experience even slower without the help of a local IDE to compile and browse.

A better solution

The problem here is that the download of jars (binary, source and docs) happens upfront when the user clicks “import project” in the IDE. In most of the cases, the download of source and doc jars are not necessary because users will most likely never browse all dependencies of a project!

I think we could address this problem by making the source and doc jar resolution lazy and letting the language server handle it. dependencySources would be free not to return any source jars, and IntelliJ, metals or Dotty IDE would ask the build tool to resolve the jar of a dependency when the user opens up a file that hasn’t been indexed.

This approach will save disk space in people’s computers and save time when doing the full import project in the IDE.

This enhancement would require the addition of a ResolutionProvider and a buildTarget/resolve endpoint (similar to `buildTarget/dependencySources). This endpoint would take a list of URIs (binary jars) and return a list of (resolved) source jars. The idea is that the build tool will only resolve the source jars for the requested binary jars. We may want to make some parts of this language-specific.

/cc @jastice

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
olafurpgcommented, Jun 11, 2018

I see what you mean. I agree this might be a good idea, and one example of how client/server may be better than eagerly persisting all information to JSON/XML on disk. I would let it wait for a future version of BSP (maybe v2), I suspect it requires custom work on both sides (IDEs + build tools) to make this feature work well.

0reactions
jasticecommented, Jun 26, 2021

@retronym technically yes, there even is an existing mechanism for first pass/second pass import, but we effectively skip the first pass so that the user can start editing even if the server fails completely. Adding a third pass to this might be more complicated though, and would be more resource-consuming. Partial updates of imports and attaching sources later is also possible, but makes things more complicated, too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

backlog Milestone · GitHub
Add explicit resolution capabilities to bsp enhancement New feature or request proposal spec Involves a modification to the spec. #14 opened on Jun...
Read more >
Overview - Build Server Protocol
This document is the specification of the Build Server Protocol (BSP). ... add the "manual" tag comes from a similar functionality * that...
Read more >
Custom Board Support Package (BSP) Tutorial: Step 5
In MHC, navigate to BSP Configuration > Use BSP > Select BSP to use for PIC32MZ2048EFM100. You can see the newly created BSP...
Read more >
BSP Data Interchange Specifications Handbook - IATA
that is Attachment “A” of PSC Resolution 750–BSP Data Interchange ... IATA will provide a Questionnaire describing BSP functionality and ...
Read more >
Introduction to BSP and Intel TCC mode for Real-time Systems
Intel uses PREEMPT_RT patch with selected kernel parameters to create a real-time operating system that enables high resolution timers and CPU isolation feature...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found