You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
C# documents support VS Code's "Sticky Scroll" feature when configured with the default settings ("editor.stickyScroll.defaultModel": "outlineModel").
Actual behavior
The C# extension's outline model (provided by DocumentSymbolProvider) flattens the document hierarchy and excludes critical symbols like namespaces, which breaks the "Sticky Scroll" behavior.
Additional context
This issue can be partially worked around by changing editor.stickyScroll.defaultModel to foldingProviderModel for C# projects, but this is an imperfect solution that produces its own set of problems.
Compare/contrast the Outline view and sticky-scroll behavior of the C# document above with this (roughly) equivalent TypeScript document:
namespaceExample{exportclassFoo{privatelorem=0;privateipsum=1;// Super contrived example because TypeScript doesn't do enums nested in classesstaticreadonlyBar=class{staticreadonlyNone=0;staticreadonlyOne=1;staticreadonlyTwo=2;staticreadonlyThree=3;}private_dolor: 0|1|2|3=Foo.Bar.None;getdolor(){returnthis._dolor;}setdolor(value){this._dolor=value;}constructor(lorem: number,ipsum: number,dolor: 0|1|2|3){this.lorem=lorem;this.ipsum=ipsum;this.dolor=dolor;}swapLipsum(): void{[this.ipsum,this.lorem]=[this.lorem,this.ipsum];}sum=()=>this.lorem+this.ipsum+this.dolor;inc(): Foo{letresult=newFoo(this.lorem,this.ipsum,this.dolor);++result.lorem;++result.ipsum;result.dolor=((result.dolor+1)%4)as0|1|2|3;returnresult;}}}
Screenshots
Environment data
dotnet --info output:
.NET SDK:
Version: 9.0.100
Commit: 59db016f11
Workload version: 9.0.100-manifests.4a280210
MSBuild version: 17.12.7+5b8665660
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.100\
.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.0
Architecture: x64
Commit: 9d5a6a9aa4
.NET SDKs installed:
3.1.426 [C:\Program Files\dotnet\sdk]
9.0.100 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
VS Code version: 1.97.1
C# Extension version: 2.63.32
OmniSharp log
N/A
The text was updated successfully, but these errors were encountered:
Expected behavior
C# documents support VS Code's "Sticky Scroll" feature when configured with the default settings (
"editor.stickyScroll.defaultModel": "outlineModel"
).Actual behavior
The C# extension's outline model (provided by
DocumentSymbolProvider
) flattens the document hierarchy and excludes critical symbols like namespaces, which breaks the "Sticky Scroll" behavior.Additional context
This issue can be partially worked around by changing
editor.stickyScroll.defaultModel
tofoldingProviderModel
for C# projects, but this is an imperfect solution that produces its own set of problems.Steps to reproduce
Setup a C# project with this example document:
Compare/contrast the Outline view and sticky-scroll behavior of the C# document above with this (roughly) equivalent TypeScript document:
Screenshots
Environment data
dotnet --info
output:VS Code version: 1.97.1
C# Extension version: 2.63.32
OmniSharp log
N/A
The text was updated successfully, but these errors were encountered: