Commit 2798396
authored
Improve solution load performance (#11591)
Razor's language server does a lot of extra work to initialize that is
really no longer necessary, at least in Visual Studio. This pull request
is an attempt to remove a bunch of that extra work.
- In Visual Studio, no longer initialize the misc files project with
_all- of the `*.razor` and `*.cshtml` files in the workspace root path.
With the `IRazorProjectInfoDriver` in place, I believe this to be
unnecessary work. Note that I've left this behavior for VS Code for now,
but we might remove it later.
- If we *do* initialize the misc files project with all Razor files, add
a method to `IRazorProjectServer` to add all of the documents to the
`ProjectSnapshotManager` at once. Adding them one at a time results in a
ton of extra asynchrony that slows solution load down as each document
add hops around the thread pool.
- When `IRazorProjectService.OpenDocumentAsync(...)` is called, it first
attempts to add the open document to the misc files project. This is
because we might learn of an open document before the project system is
done loading. However, it first adds the document using a `TextLoader`
that loads the file off disk. Then, it updates the document with the
`SourceText` that was passed to `OpenDocumentAsync`. However, this
causes the file to be loaded so that its contents can be compared with
the new `SourceText`. To avoid this additional I/O, `OpenDocumentAsync`
will now add the document to the misc files project with the
`SourceText` rather than a `TextLoader`.
- Don't create `DocumentSnapshot` instances unnecessarily when checking
to see if a project contains a document file path.
In addition, I've refactored all of the `IFileChangeDetector` and
`IRazorFileChangeListener` abstractions into the singleton,
`WorkspaceRootPathWatcher`. There was only a single implementation of
each, so they really don't have a lot of value. I've similar unified a
bunch of relevant tests.
CI Build:
https://dev.azure.com/dnceng/internal/_build/results?buildId=2656343&view=results
VS Test Insertion:
https://dev.azure.com/devdiv/DevDiv/_git/VS/pullrequest/616458File tree
29 files changed
+532
-579
lines changed- src
- Razor
- src
- Microsoft.AspNetCore.Razor.LanguageServer
- Extensions
- Hosting
- ProjectSystem
- Microsoft.CodeAnalysis.Razor.Workspaces
- Microsoft.CodeAnalysis.Remote.Razor/Initialization
- Microsoft.VisualStudio.LanguageServices.Razor
- test
- Microsoft.AspNetCore.Razor.LanguageServer.Test
- Refactoring
- Microsoft.AspNetCore.Razor.Test.Common.Tooling
- Workspaces
- Microsoft.VisualStudio.LanguageServices.Razor.Test/Discovery
29 files changed
+532
-579
lines changedLines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
45 | 47 | | |
src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs
Lines changed: 2 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
| 217 | + | |
| 218 | + | |
222 | 219 | | |
223 | 220 | | |
224 | 221 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
43 | 50 | | |
44 | 51 | | |
45 | 52 | | |
| |||
62 | 69 | | |
63 | 70 | | |
64 | 71 | | |
| 72 | + | |
65 | 73 | | |
66 | 74 | | |
67 | 75 | | |
| |||
Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 17 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | | - | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
72 | 88 | | |
73 | 89 | | |
74 | 90 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
Lines changed: 65 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
142 | 184 | | |
143 | 185 | | |
144 | 186 | | |
145 | 187 | | |
146 | 188 | | |
147 | 189 | | |
148 | | - | |
149 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
150 | 197 | | |
151 | 198 | | |
152 | 199 | | |
153 | 200 | | |
154 | | - | |
| 201 | + | |
155 | 202 | | |
156 | | - | |
157 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
158 | 206 | | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
| 207 | + | |
165 | 208 | | |
166 | 209 | | |
| 210 | + | |
167 | 211 | | |
168 | 212 | | |
169 | 213 | | |
170 | 214 | | |
171 | 215 | | |
172 | | - | |
173 | 216 | | |
174 | | - | |
175 | | - | |
176 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
177 | 225 | | |
178 | 226 | | |
179 | 227 | | |
| |||
183 | 231 | | |
184 | 232 | | |
185 | 233 | | |
186 | | - | |
187 | | - | |
188 | 234 | | |
189 | 235 | | |
190 | 236 | | |
191 | | - | |
| 237 | + | |
192 | 238 | | |
193 | 239 | | |
194 | 240 | | |
195 | 241 | | |
196 | | - | |
| 242 | + | |
197 | 243 | | |
198 | 244 | | |
199 | 245 | | |
| |||
Lines changed: 0 additions & 66 deletions
This file was deleted.
0 commit comments