HackMD
  • Prime
    Prime  Full-text search on all paid plans
    Search anywhere and reach everything in a Workspace with Prime plan.
    Got it
      • Create new note
      • Create a note from template
    • Prime  Full-text search on all paid plans
      Prime  Full-text search on all paid plans
      Search anywhere and reach everything in a Workspace with Prime plan.
      Got it
      • Sharing Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • More (Comment, Invitee)
      • Publishing
        Everyone on the web can find and read all notes of this public team.
        After the note is published, everyone on the web can find and read this note.
        See all published notes on profile page.
      • Commenting Enable
        Disabled Forbidden Owners Signed-in users Everyone
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
        • Everyone
      • Invitee
      • No invitee
      • Options
      • Versions and GitHub Sync
      • Transfer ownership
      • Delete this note
      • Template
      • Save as template
      • Insert from template
      • Export
      • Dropbox
      • Google Drive
      • Gist
      • Import
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
      • Download
      • Markdown
      • HTML
      • Raw HTML
    Menu Sharing Create Help
    Create Create new note Create a note from template
    Menu
    Options
    Versions and GitHub Sync Transfer ownership Delete this note
    Export
    Dropbox Google Drive Gist
    Import
    Dropbox Google Drive Gist Clipboard
    Download
    Markdown HTML Raw HTML
    Back
    Sharing
    Sharing Link copied
    /edit
    View mode
    • Edit mode
    • View mode
    • Book mode
    • Slide mode
    Edit mode View mode Book mode Slide mode
    Note Permission
    Read
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Write
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    More (Comment, Invitee)
    Publishing
    Everyone on the web can find and read all notes of this public team.
    After the note is published, everyone on the web can find and read this note.
    See all published notes on profile page.
    More (Comment, Invitee)
    Commenting Enable
    Disabled Forbidden Owners Signed-in users Everyone
    Permission
    Owners
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Invitee
    No invitee
       owned this note    owned this note      
    Published Linked with GitHub
    Like BookmarkBookmarked
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # 2019.11.18: RLS + rust-analyzer integration See the [main discussion document](https://hackmd.io/9qrJYdSLTK2MWG4-pbmpWw) ## Prep work for next meeting * See what features RLS has over Rust Analyzer and vice versa * Understand other save-analysis consumers' needs (when RLS is deprecated) * Mozilla's searchfox? * @est31 * nrc's [cargo-src](https://github.com/rust-dev-tools/cargo-src) * [Issues labeled A-save-analysis](https://github.com/rust-lang/rust/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+label%3AA-save-analysis) * Proposed architectural alternatives (not necessarily mutually exclusive) * freeze RLS, focus all energy on rust-analyzer * extend rust-analyzer with ability to consume save-analysis data in some form * integrate rust-analyzer into RLS as a "racer alternative" (even worth discussing? unclear) * What are some "quality metrics" we could use to judge when rust-analyzer is "ready"? * Feature set * Precision * Niko proposed identify a set of crates and requiring >90% (or some threshold) precision from type-checker on those crates * Requires ability to check type-checker against rustc (another possible role for save-analysis) * Set of crates where features must work? * Parts of the language that must be covered? * In our discussion on [2019.11.06], we also covered this some * Matklad suggested that any "uncovered language features" should be well known and generally require "just work" (no architectural rewrites) * But procedural macros might be an exception -- and perhaps there are others? ## Notes from meeting * matklad attempted an experiment to integrate save-analysis into a simple tool * short script that implements "find all refs" (targeting "rename symbol") * using save-analysis library * have to pass `-Zsave-analysis`, which requires "BOOTSTRAP" but... * takes a line/col. number ## * First topic: how "ready" is rust-analyzer, how should we advertise it * Want to avoid calling r-a "beta quality" * Didn't like the messaging around RLS 1.0 / 2.0 * trying to say that this is ready, but folks would respond not really * rust-analyzer is not really ready * can't be ready in a year, maybe two years * "two years" is effectively infinity * Igor -- situation is sort of the same with RLS * What would it take to feel more comfortable? * matklad: shared code-base for the core analysis with rustc * I would feel ok if it were separate but complete (no major missing features) * how conservative will we have to be to avoid breakage etc? * some kind of release process would be needed * bug triaging * See what features RLS has over Rust Analyzer and vice versa ``` |feature |rust-analyzer | rls | rename | incomplete | ✓ | error reporting | X | ✓ | completion | ✓ | provided by racer, not precise | goto definition | ✓ | ✓ | goto type definition | ✓ | ? | find references | incomplete | ✓ | assists | ✓, can add more | X | typing handlers | PoC, can add more | X | complex refactorings | incomplete | X | running tests | ✓ | exists, but imprecise (regex-based) and incomplete | type hints | ✓ | X | syntax highlighting | ✓ | X | structural search replace | X | X | interactive macro expansion | X | X | lifetime visualization| X | X | symbol search | ✓ | ✓ | single file analysis | somewhat | ? | extend selection | ✓ | ? | foldnig | ✓ | ? |=== ``` Core differentiator at present: * RLS has precise find-all-references and rename (based on save-analysis) * rust-analyzer has incomplete, imprecise support * https://github.com/rust-analyzer/renamer * error reporting * rust-analyzer uses `cargo watch` * RLS does "sort of the same thing" # Architecture possibility * Invoke compiler to get save-analysis, errors * build up native compatibility * One route that matklad is elaborating on * build a command-line tool * rust-analyzer invokes this tool as a subprocess (other consumers could do so as well) * we can also pack things like `cargo src` into that * save-analysis is getting re-generated by running `cargo check` with some argument * preference in rust-analyzer UI ("which rename algorithm to use") * when checked, rust-analyzer will run this process etc on a regular basis * also requires user to actually save all documents to disk * today `cargo watch` is not requiring saving files, giving strange feedback * If we wanted to avoid saving files, there are alternatives * But what other problems do we have * reusing data between invocations * second rename has to run cargo check from scratch? * incremental? * limitation: if there are errors, data is not great * limitation: custom build plans etc * but we can permit people to supply their own command ## proposed consensus * we will integrate "rustc generating save-analysis" code into rust-analyzer to handle * error reporting * find all references * precise rename * but offer preference(s) to switch to "native" implementations of those 3 features * (Observation: this also enables us to compare between the two automatically) ## unresolved questions * will we be using a separate process that is invoked (`cargo rename`) etc? * or do we want something resident? * can we migrate save-analysis to LSIF and how should we do that? # overall plan * library-ification proceeds * build a version of rust-analyzer that incorporates save-analysis as above * ("RLS 2.0") * advertise it as a "pre-alpha" or "alpha" software * given sufficient caveats * "useful" # what happens to RLS 1.0 then? * delivered via rustup today * does RLS 1.0 just remain, frozen, but stable? * improve "user-first" installation for cargo? * so you don't have to build from source * first thing we should strive for: user parity (save-analysis basically does that) * does this let us gauge how many projects that worked will stop working * also true, need for a internal format for formal structure? * but save-analysis is sort of high level * stage 1: * existing RLS is in maintenance * we extract and build up this "command-line tools" or whatever for rust-analyzer * stage 2, entering a triage/trial period: * we compare against some set of crates and project * stage 3: * ship rust-analyzer as the "new RLS" with rustup * this *should* work with other editors out of the box * though RA does have a bit of "extra features" (extensions to the underlying LSP)

    Import from clipboard

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lost their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template is not available.


    Upgrade

    All
    • All
    • Team
    No template found.

    Create custom template


    Upgrade

    Delete template

    Do you really want to delete this template?

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Tutorials

    Book Mode Tutorial

    Slide Mode Tutorial

    YAML Metadata

    Contacts

    Facebook

    Twitter

    Feedback

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions

    Versions and GitHub Sync

    Sign in to link this note to GitHub Learn more
    This note is not linked with GitHub Learn more
     
    Add badge Pull Push GitHub Link Settings
    Upgrade now

    Version named by    

    More Less
    • Edit
    • Delete

    Note content is identical to the latest version.
    Compare with
      Choose a version
      No search result
      Version not found

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub

        Please sign in to GitHub and install the HackMD app on your GitHub repo. Learn more

         Sign in to GitHub

        HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Available push count

        Upgrade

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Upgrade

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully