Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge main to tokenizer branch #10724

Merged
merged 64 commits into from
Aug 12, 2024

Commits on Jul 5, 2024

  1. Configuration menu
    Copy the full SHA
    459fb2a View commit details
    Browse the repository at this point in the history

Commits on Jul 25, 2024

  1. Configuration menu
    Copy the full SHA
    5191c83 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6e4cf07 View commit details
    Browse the repository at this point in the history
  3. Add more services tests

    davidwengier committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    2437736 View commit details
    Browse the repository at this point in the history
  4. Create isolated workspaces in case tests overlap

    This was done because originally with inlay hints I was changing global options in Roslyn, but ended up moving away from that. Still makes sense though.
    davidwengier committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    f179fb9 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    3a21f34 View commit details
    Browse the repository at this point in the history
  6. Cleanup

    davidwengier committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    51756c1 View commit details
    Browse the repository at this point in the history
  7. Cleanup

    davidwengier committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    ed53daf View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    0fe459e View commit details
    Browse the repository at this point in the history
  9. Cleanup

    davidwengier committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    08f7362 View commit details
    Browse the repository at this point in the history

Commits on Jul 26, 2024

  1. Fix excerpt service to allow for multi line verbatim strings that kin…

    …da are but kinda aren't supported in Razor
    davidwengier committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    40e409e View commit details
    Browse the repository at this point in the history

Commits on Jul 29, 2024

  1. Configuration menu
    Copy the full SHA
    8806e92 View commit details
    Browse the repository at this point in the history

Commits on Jul 30, 2024

  1. Configuration menu
    Copy the full SHA
    88b3813 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    db8eade View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3f7545b View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    02854ec View commit details
    Browse the repository at this point in the history
  5. Fixes after bump

    davidwengier committed Jul 30, 2024
    Configuration menu
    Copy the full SHA
    227b0c9 View commit details
    Browse the repository at this point in the history
  6. Remove unused usings

    davidwengier committed Jul 30, 2024
    Configuration menu
    Copy the full SHA
    2a06fcc View commit details
    Browse the repository at this point in the history
  7. PR Feedback

    davidwengier committed Jul 30, 2024
    Configuration menu
    Copy the full SHA
    240a123 View commit details
    Browse the repository at this point in the history
  8. Remove unused using

    davidwengier committed Jul 30, 2024
    Configuration menu
    Copy the full SHA
    e4f1677 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    788988b View commit details
    Browse the repository at this point in the history

Commits on Jul 31, 2024

  1. Cohost inlay hint support (dotnet#10672)

    Part of dotnet#9519
    Needs dotnet/roslyn#74548 before it will compile
    Needs
    https://devdiv.visualstudio.com/DevDiv/_git/VSLanguageServerClient/pullrequest/567229
    before it will work in VS
    
    There were a few side quests on this one:
    * Roslyn OOP, at least the way we access it, doesn't have any options
    set, so took a few tries to get the Roslyn side of this right for our
    needs
    * I wrote this feature test-first so only discovered the lack of options
    after I modified Roslyn and our test infra to allow us to set global
    options, so ended up removing most of that code, Kept the bit about
    isolated workspaces because it just makes sense.
    * Had to re-write one of the `DocumentMappingService` methods to use
    `TextChange` instead of `TextEdit` so I could use Roslyn LSP types
    * The hacky, and fortunately temporary, way we were doing generated C#
    content was causing cache misses in Roslyn in tests, so fixed that up
    * When I finally got up to manual testing I found a bug in the platform
    that meant inlay hints just don't work with dynamic registration, so
    filed the above linked PR to fix that
    
    If reviewing commit-at-a-time please note that the first commit was
    written before the reworking of extension methods and LSP types, and the
    fixes for that are in the last commit.
    davidwengier authored Jul 31, 2024
    Configuration menu
    Copy the full SHA
    c78f5f2 View commit details
    Browse the repository at this point in the history

Commits on Aug 1, 2024

  1. Configuration menu
    Copy the full SHA
    4358b4c View commit details
    Browse the repository at this point in the history
  2. Merge release/dev17.10 to release/dev17.11 (dotnet#10587)

    This is an automatically generated pull request from release/dev17.10
    into release/dev17.11.
    
    
    Once all conflicts are resolved and all the tests pass, you are free to
    merge the pull request. 🐯
    
    ## Troubleshooting conflicts
    
    ### Identify authors of changes which introduced merge conflicts
    Scroll to the bottom, then for each file containing conflicts copy its
    path into the following searches:
    - https://github.com/dotnet/razor/find/release/dev17.10
    - https://github.com/dotnet/razor/find/release/dev17.11
    
    Usually the most recent change to a file between the two branches is
    considered to have introduced the conflicts, but sometimes it will be
    necessary to look for the conflicting lines and check the blame in each
    branch. Generally the author whose change introduced the conflicts
    should pull down this PR, fix the conflicts locally, then push up a
    commit resolving the conflicts.
    
    ### Resolve merge conflicts using your local repo
    Sometimes merge conflicts may be present on GitHub but merging locally
    will work without conflicts. This is due to differences between the
    merge algorithm used in local git versus the one used by GitHub.
    ``` bash
    git fetch --all
    git checkout -t upstream/merges/release/dev17.10-to-release/dev17.11
    git reset --hard upstream/release/dev17.11
    git merge upstream/release/dev17.10
    # Fix merge conflicts
    git commit
    git push upstream merges/release/dev17.10-to-release/dev17.11 --force
    ```
    dotnet-bot authored Aug 1, 2024
    Configuration menu
    Copy the full SHA
    78a398c View commit details
    Browse the repository at this point in the history
  3. Merge release/dev17.11 to main (dotnet#10700)

    This is an automatically generated pull request from release/dev17.11
    into main.
    
    
    Once all conflicts are resolved and all the tests pass, you are free to
    merge the pull request. 🐯
    
    ## Troubleshooting conflicts
    
    ### Identify authors of changes which introduced merge conflicts
    Scroll to the bottom, then for each file containing conflicts copy its
    path into the following searches:
    - https://github.com/dotnet/razor/find/release/dev17.11
    - https://github.com/dotnet/razor/find/main
    
    Usually the most recent change to a file between the two branches is
    considered to have introduced the conflicts, but sometimes it will be
    necessary to look for the conflicting lines and check the blame in each
    branch. Generally the author whose change introduced the conflicts
    should pull down this PR, fix the conflicts locally, then push up a
    commit resolving the conflicts.
    
    ### Resolve merge conflicts using your local repo
    Sometimes merge conflicts may be present on GitHub but merging locally
    will work without conflicts. This is due to differences between the
    merge algorithm used in local git versus the one used by GitHub.
    ``` bash
    git fetch --all
    git checkout -t upstream/merges/release/dev17.11-to-main
    git reset --hard upstream/main
    git merge upstream/release/dev17.11
    # Fix merge conflicts
    git commit
    git push upstream merges/release/dev17.11-to-main --force
    ```
    dotnet-bot authored Aug 1, 2024
    Configuration menu
    Copy the full SHA
    1764b62 View commit details
    Browse the repository at this point in the history

Commits on Aug 5, 2024

  1. Configuration menu
    Copy the full SHA
    0f56e69 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    59e6260 View commit details
    Browse the repository at this point in the history
  3. Move down and interface-ize component search engine, and introduce IP…

    …rojectCollectionResolver (dotnet#10706)
    
    Started this for dotnet#10688 but saw
    that Go To Def used the same service, so figured @DustinCampbell would
    need to do the same thing, and thought it would be easier to put it up
    separately.
    
    (Unless of course you've already done this, or similar, Dustin in which
    case I can just abandon this, nbd)
    davidwengier authored Aug 5, 2024
    Configuration menu
    Copy the full SHA
    36542b2 View commit details
    Browse the repository at this point in the history

Commits on Aug 6, 2024

  1. Configuration menu
    Copy the full SHA
    ea2e567 View commit details
    Browse the repository at this point in the history
  2. Rework DocumentContext

    This change updates `DocumentContext` is several ways:
    
    1. Fields used for caching are now assigned with `Interlocked.Initialize(...)` to ensure that the same value are used in race scenarios.
    2. All public async methods now return `ValueTask` rather than `Task`. This has lower overhead since the async methods will return synchronously after the first call.
    3. Members are no longer virtual. This appears to have been originally done to allow `DocumentContext` to be mocked for tests, which isn't the right way to handle testing. Instead, since `DocumentContext` delegates its implementation to its `IDocumentSnapshot`, the snapshot should be mocked to change the implementation.
    4. The Identifier property has been converted to a method, since it creates a new object every time.
    DustinCampbell committed Aug 6, 2024
    Configuration menu
    Copy the full SHA
    a5ddcd7 View commit details
    Browse the repository at this point in the history
  3. Introduce IEditMappingService

    In order to remove `IDocumentContextFactory` from `AbstractRazorDocumentMappingService`, it's necessary to split `IRazorDocumentMappingService` into different services. The goal is to make `IRazorDocumentMappingService` provide APIs that only perform mapping using Roslyn primitives, such as `LinePosition`, `LinePositionSpan`, and `TextChange`. `IEditMappingService` contains an API moved from `IRazorDocumentMappingService` that remaps a `WorkspaceEdit`.
    DustinCampbell committed Aug 6, 2024
    Configuration menu
    Copy the full SHA
    c0bc542 View commit details
    Browse the repository at this point in the history
  4. Add RazorCodeDocument.TryGetGeneratedDocument(...) extension method

    This allows `EditMappingService` and `AbstractRazorDocumentMappingService` to share a helper method.
    DustinCampbell committed Aug 6, 2024
    Configuration menu
    Copy the full SHA
    d638bce View commit details
    Browse the repository at this point in the history
  5. Remove IDocumentContextFactory from AbstractRazorDocumentMappingService

    This change removes `IDocumentContextFactory` from the `AbstracRazorDocumentMappingService` and replaces the single usage with a new protected abstract method.
    DustinCampbell committed Aug 6, 2024
    Configuration menu
    Copy the full SHA
    75e06cb View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    e3d9258 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    f3f3ac7 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    d5dc280 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    58161c0 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    a550cbb View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    655a88c View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    20dd630 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    fc6aa07 View commit details
    Browse the repository at this point in the history

Commits on Aug 7, 2024

  1. Move MapToHostDocuementUriAndRangeAsync to extension methods

    This change also removes the `AbstractDocumentMappingService.TryGetCodeDocumentAsync(...)` method that was added in an an early commit.
    DustinCampbell committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    50a3d41 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e4a6932 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    358c2bf View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    a2c21cf View commit details
    Browse the repository at this point in the history
  5. Co-hosting: Add API for mapping a generated document URI and range ba…

    …ck to the host document (dotnet#10712)
    
    There's a fair amount of refactoring here, but I was careful to separate
    everything. So, I recommend reviewing commit-by-commit.
    DustinCampbell authored Aug 7, 2024
    Configuration menu
    Copy the full SHA
    fb84ae5 View commit details
    Browse the repository at this point in the history

Commits on Aug 8, 2024

  1. Configuration menu
    Copy the full SHA
    2c0e252 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    00e584a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    53ec3ab View commit details
    Browse the repository at this point in the history
  4. Make Compilation a TagHelperDescriptorProviderContext property

    Every single `TagHelperDescriptorProviderContext` created in Razor compiler or tooling code adds a valid compilation. So, adding the compilation to the `ItemsCollection` is pure overhead and no `ITagHelperDescriptorProvider` needs to check it for null.
    
    I removed a single test that verified the behavior if a compilation was never set. Now that a compilation is required, this test is no longer needed.
    DustinCampbell committed Aug 8, 2024
    Configuration menu
    Copy the full SHA
    adff92a View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    ec5cd16 View commit details
    Browse the repository at this point in the history
  6. Remove TagHelperDescriptorProviderContext.Items property

    This can be safely removed now that there are no more references.
    DustinCampbell committed Aug 8, 2024
    Configuration menu
    Copy the full SHA
    45625bc View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    9476634 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    eae0d53 View commit details
    Browse the repository at this point in the history
  9. Clean up all ITagHelperDescriptorProviders a bit (and found a bug!)

    - Enable nullability
    - Mark all as sealed
    - Use `Lazy<T>` for singleton `ITagHelperDescriptorProviders`
    - Introduce `TagHelperDescriptorProviderBase`
    - Inherit from `TagHelperDescriptorProviderBase`
    - Remove unnecessary properties
    - Remove unnecessary property setters
    
    In addition, I spotted a bug in `EventHandlerTagDescriptorProvider` while addressing nullability warnings. The buggy code is right here:
    
    https://github.com/dotnet/razor/blob/fb84ae5d9bb8132972c2c23cf209721161f81deb/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/EventHandlerTagHelperDescriptorProvider.cs#L70-L76
    
    When reading the constructor arguments of an `EventHandlerAttribute` it appears that we swap the last two arguments of the 4-argument variant. The constructor is defined like so:
    
    ```C#
    EventHandlerAttribute(string attributeName, Type eventArgsType, bool enableStopPropagation, bool enablePreventDefault);
    ```
    
    Unfortunately, the compiler reads the third parameter as `enablePreventDefaeult` and the fourth parameter as `enableStopPropagation`.
    
    This has been broken since support for the 4-argument constructor variant was added in dotnet@7635bba. Fixing this bug is tracked by dotnet#10497.
    DustinCampbell committed Aug 8, 2024
    Configuration menu
    Copy the full SHA
    5fbfc0d View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    9f6c7b6 View commit details
    Browse the repository at this point in the history
  11. I spent 10 minutes looking up cool Mr Freeze catch phrases for this c…

    …ommit message, and I didn't like any of them.
    davidwengier committed Aug 8, 2024
    Configuration menu
    Copy the full SHA
    79b2d26 View commit details
    Browse the repository at this point in the history
  12. Don't pass RazorCodeDocument and SourceText around together (dotn…

    …et#10719)
    
    because it's really easy to get one from the other.
    
    While working on rename in cohosting, I noticed this unnecessary extra
    bit of work while calling `GetPositionInfo`, so I fixed it. Then I
    thought I'd see where else `GetSourceTextAsync` was used in an non-ideal
    way, and that was clearly going to be too big for the rename PR so I
    separated it out into it's own PR. Then I heard Dustin say he was
    changing `DocumentSnapshot` so the unnecessary work will end up being
    much less wasteful anyway, plus we'd probably just have conflicts, so I
    pared the whole thing right back to just this minor removal of a couple
    of unnecessary parameters. Enjoy.
    davidwengier authored Aug 8, 2024
    Configuration menu
    Copy the full SHA
    d5cfe11 View commit details
    Browse the repository at this point in the history

Commits on Aug 9, 2024

  1. Unskip rename tests

    davidwengier committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    4441e1d View commit details
    Browse the repository at this point in the history
  2. Try to fix rename tests

    davidwengier committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    ed8dcee View commit details
    Browse the repository at this point in the history
  3. Move to central package pinning (dotnet#10716)

    * Move to central package pinning
    
    This should make it much easier for us to respond to CG alerts in the
    future. All that will need to be done is add an entry in
    Directory.Packages.props and it will automatically impact all consumers
    of it.
    
    Consider this example in Roslyn for how to respond to a CG issue
    
    dotnet/roslyn#74653
    jaredpar authored Aug 9, 2024
    Configuration menu
    Copy the full SHA
    cd1f82b View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    9044af2 View commit details
    Browse the repository at this point in the history

Commits on Aug 12, 2024

  1. Remove ItemCollection from TagHelperDescriptorProviderContext (dotnet…

    …#10720)
    
    Every `TagHelperDescriptorProviderContext` creates an `ItemCollection`
    to hold onto, at most, two objects: a `Compilation` and a target
    `ISymbol`. This is enormously wasteful because an `ItemCollection`
    internally creates a `ConcurrentDictionary<object, object>`. So, I've
    changed `TagHelperDescriptorProviderContext` to just hold onto a
    compilation and a target symbol and avoid the `ItemCollection`
    altogether.
    
    I recommend reviewing commit-by-commit.
    
    Also, I bumped into a long standing compiler bug in
    `EventHandlerTagHelperDescriptorProvider` that was recently filed by a
    customer: dotnet#10497. I opted to stay
    on target and not fix this issue, but I made it painfully obvious where
    the fix would go. 😄
    DustinCampbell authored Aug 12, 2024
    Configuration menu
    Copy the full SHA
    3920563 View commit details
    Browse the repository at this point in the history
  2. Merge remote-tracking branch 'upstream/main' into features/roslyn-tok…

    …enizer
    
    * upstream/main: (53 commits)
      Move to central package pinning (dotnet#10716)
      Try to fix rename tests
      Unskip rename tests
      I spent 10 minutes looking up cool Mr Freeze catch phrases for this commit message, and I didn't like any of them.
      Clean up CompilationTagHelperResolver
      Clean up all ITagHelperDescriptorProviders a bit (and found a bug!)
      Make ExcludeHidden and IncludeDocumentation init-only properties
      Swap TagHelperDescriptorProviderContext.Create methods for constructors
      Remove TagHelperDescriptorProviderContext.Items property
      Make TargetSymbol a TagHelperDescriptorProviderContext property
      Make Compilation a TagHelperDescriptorProviderContext property
      Merge TagHelperDescriptorProviderContext and DefaultContext
      Don't pass code document and source text around in diagnostics translator, plus some cleanup
      Remove unnecessary parameter, because it can be trivially retrieved
      Find razor document correctly in RemoveDocumentMappingService
      Add extension methods that convert URIs to Roslyn file paths
      Use Uri.LocalPath rather than GetAbsoluteOrUNCPath()
      Move MapToHostDocuementUriAndRangeAsync to extension methods
      Fix small typo in comment
      Remove unused DocumentState method
      ...
    333fred committed Aug 12, 2024
    Configuration menu
    Copy the full SHA
    711bda8 View commit details
    Browse the repository at this point in the history