Adding new types aren't recognized until restarting VSCode
- Dominant language
- TypeScript
- Stars
- 3.1k
- Forks
- 737
- Avg merge
- 17h 56m
- Merged PRs (30d)
- 21
Description
## Environment data
`dotnet --info` output:
```shell
.NET SDK:
Version: 7.0.400
Commit: 73bf45718d
Runtime Environment:
OS Name: Mac OS X
OS Version: 13.5
OS Platform: Darwin
RID: osx.13-arm64
Base Path: /usr/local/share/dotnet/sdk/7.0.400/
Host:
Version: 7.0.10
Architecture: arm64
Commit: a6dbb800a4
.NET SDKs installed:
6.0.404 [/usr/local/share/dotnet/sdk]
7.0.203 [/usr/local/share/dotnet/sdk]
7.0.400 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.12 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.10 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.12 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.10 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
x64 [/usr/local/share/dotnet/x64]
registered at [/etc/dotnet/install_location_x64]
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
```
## OmniSharp log
```
Using dotnet configured on PATH
Dotnet path: /usr/local/share/dotnet/dotnet
Activating C# + C# Dev Kit + C# IntelliCode...
[Info - 8:50:14 AM] [Program]Language server initialized
[Error - 8:50:37 AM] [LanguageServerHost]System.ArgumentException: The changes must not overlap. (Parameter 'changes')
at Microsoft.CodeAnalysis.Text.SourceText.WithChanges(IEnumerable`1 changes) in /_/src/Compilers/Core/Portable/Text/SourceText.cs:line 679
at Microsoft.CodeAnalysis.Text.ChangedText.WithChanges(IEnumerable`1 changes) in /_/src/Compilers/Core/Portable/Text/ChangedText.cs:line 158
at Microsoft.CodeAnalysis.Completion.Providers.AbstractImportCompletionProvider.GetChangeAsync(Document document, CompletionItem completionItem, Nullable`1 commitKey, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/AbstractImportCompletionProvider.cs:line 196
at Microsoft.CodeAnalysis.Completion.CompletionService.GetChangeAsync(Document document, CompletionItem item, Nullable`1 commitCharacter, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/Completion/CompletionService.cs:line 237
at Microsoft.CodeAnalysis.LanguageServer.Handler.Completion.AbstractLspCompletionResultCreationService.GenerateAdditionalTextEditForImportCompletionAsync(CompletionItem selectedItem, Document document, CompletionService completionService, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/Completion/AbstractLspCompletionResultCreationService.cs:line 398
at Microsoft.CodeAnalysis.LanguageServer.Handler.Completion.DefaultLspCompletionResultCreationService.ResolveAsync(CompletionItem lspItem, CompletionItem roslynItem, TextDocumentIdentifier textDocumentIdentifier, Document document, CompletionCapabilityHelper capabilityHelper, CompletionService completionService, CompletionOptions completionOptions, SymbolDescriptionOptions symbolDescriptionOptions, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/Completion/DefaultLspCompletionResultCreationService.cs:line 89
at Microsoft.CodeAnalysis.LanguageServer.Handler.CompletionResolveHandler.HandleRequestAsync(CompletionItem completionItem, RequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionResolveHandler.cs:line 66
at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`3.StartRequestAsync(TRequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/QueueItem.cs:line 176
[Error - 8:50:37 AM] Request completionItem/resolve failed.
Message: The changes must not overlap. (Parameter 'changes')
Code: -32000
[object Object]
```
## Steps to reproduce
1. Create an empty .NET Console app (`dotnet new console`) in a folder
2. Open the folder in VSCode
3. Add a file (e.g. `Test.cs`) and fill in a namespace and add an empty class to it (e.g. `public class Test {}`
4. Open `Program.cs` and instantiate the new type: `var t = new Test()`
5. Try to use code fix to add the using statement.
6. Add the using statement for the namespace manually.
## Expected behavior
Type should be recognized and give me a code fix to add the necessary using statement. When adding the namespace manually, I would be expecting it not to have any squiggles and intellisense working.
## Actual behavior
Codefixes doesn't give me the option and the type is not recognized even after adding the namespace manually. The error in the C# Log comes while typing out the `using` statement for the namespace. If one tries to just restart the language server, the type is still not recognized. The only thing that makes it work again is restarting VSCode. This is for every type being created.
## Additional context
This problem just started happening with version 2.0.436. I've tried to revert step by step back to previous versions, but none of the 2.* versions work. Going back to version 1.26.0 makes this work again.
This is on a M1 Mac running Ventura 13.5.1.
I tried uninstalling VSCode, removing the Code folder in `Application Support` and the `.vscode` folder in the home folder. And then reinstalling it and my extensions and still didn't work on 2.0.436, but fine on 1.26.0.

Contributor guide
Assessment
This issue has not been assessed yet.