55using System . Collections . Concurrent ;
66using System . Collections . Generic ;
77using System . Collections . Immutable ;
8+ using System . Diagnostics . CodeAnalysis ;
89using System . IO ;
910using System . Linq ;
1011using System . Reflection ;
@@ -45,7 +46,7 @@ public ProjectProperties(
4546
4647 public class ProjectInformation
4748 {
48- public delegate bool Loader ( Uri projectFile , out ProjectInformation projectInfo ) ;
49+ public delegate bool Loader ( Uri projectFile , [ NotNullWhen ( true ) ] out ProjectInformation ? projectInfo ) ;
4950
5051 internal readonly ProjectProperties Properties ;
5152 public readonly ImmutableArray < string > SourceFiles ;
@@ -904,10 +905,9 @@ public Task ProjectChangedOnDiskAsync(
904905 // TODO: allow to cancel this task via cancellation token?
905906 return this . load . QueueForExecutionAsync ( ( ) =>
906907 {
907- var loaded = projectLoader ( projectFile , out ProjectInformation info ) ;
908908 var existing = this . projects . TryRemove ( projectFile , out Project current ) ? current : null ;
909909
910- if ( ! loaded )
910+ if ( ! projectLoader ( projectFile , out var info ) )
911911 {
912912 existing ? . LoadProjectAsync (
913913 ImmutableDictionary < Uri , Uri ? > . Empty ,
@@ -986,7 +986,7 @@ public Task AssemblyChangedOnDiskAsync(Uri dllPath)
986986 /// if the modified file is a source file of that project and not open in the editor
987987 /// (i.e. openInEditor is null or returns null for that file) at the time of execution.
988988 /// </summary>
989- public Task SourceFileChangedOnDiskAsync ( Uri sourceFile , Func < Uri , FileContentManager > ? openInEditor = null )
989+ public Task SourceFileChangedOnDiskAsync ( Uri sourceFile , Func < Uri , FileContentManager ? > ? openInEditor = null )
990990 {
991991 if ( sourceFile == null )
992992 {
@@ -1061,7 +1061,7 @@ public Task ManagerTaskAsync(Uri file, Action<CompilationUnitManager, bool> exec
10611061 /// or if the specified position is not a valid position within the file,
10621062 /// or if a file affected by the rename operation belongs to several compilation units.
10631063 /// </summary>
1064- public WorkspaceEdit ? Rename ( RenameParams param , bool versionedChanges ) // versionedChanges is unused (WorkspaceEdit contains both Changes and DocumentChanges, but the version nr is null)
1064+ public WorkspaceEdit ? Rename ( RenameParams ? param , bool versionedChanges ) // versionedChanges is unused (WorkspaceEdit contains both Changes and DocumentChanges, but the version nr is null)
10651065 {
10661066 if ( param ? . TextDocument ? . Uri == null )
10671067 {
@@ -1111,7 +1111,7 @@ public Task ManagerTaskAsync(Uri file, Action<CompilationUnitManager, bool> exec
11111111 /// Fails silently without logging anything if an exception occurs upon evaluating the query
11121112 /// (occasional failures are to be expected as the evaluation is a readonly query running in parallel to the ongoing processing).
11131113 /// </summary>
1114- public Location ? DefinitionLocation ( TextDocumentPositionParams param ) =>
1114+ public Location ? DefinitionLocation ( TextDocumentPositionParams ? param ) =>
11151115 this . Manager ( param ? . TextDocument ? . Uri ) ? . FileQuery (
11161116 param ? . TextDocument , ( file , c ) => file . DefinitionLocation ( c , param ? . Position ? . ToQSharp ( ) ) , suppressExceptionLogging : true ) ;
11171117
@@ -1125,7 +1125,7 @@ public Task ManagerTaskAsync(Uri file, Action<CompilationUnitManager, bool> exec
11251125 /// Fails silently without logging anything if an exception occurs upon evaluating the query
11261126 /// (occasional failures are to be expected as the evaluation is a readonly query running in parallel to the ongoing processing).
11271127 /// </summary>
1128- public SignatureHelp ? SignatureHelp ( TextDocumentPositionParams param , MarkupKind format = MarkupKind . PlainText ) =>
1128+ public SignatureHelp ? SignatureHelp ( TextDocumentPositionParams ? param , MarkupKind format = MarkupKind . PlainText ) =>
11291129 this . Manager ( param ? . TextDocument ? . Uri ) ? . FileQuery (
11301130 param ? . TextDocument , ( file , c ) => file . SignatureHelp ( c , param ? . Position ? . ToQSharp ( ) , format ) , suppressExceptionLogging : true ) ;
11311131
@@ -1138,7 +1138,7 @@ public Task ManagerTaskAsync(Uri file, Action<CompilationUnitManager, bool> exec
11381138 /// Fails silently without logging anything if an exception occurs upon evaluating the query
11391139 /// (occasional failures are to be expected as the evaluation is a readonly query running in parallel to the ongoing processing).
11401140 /// </summary>
1141- public Hover ? HoverInformation ( TextDocumentPositionParams param , MarkupKind format = MarkupKind . PlainText ) =>
1141+ public Hover ? HoverInformation ( TextDocumentPositionParams ? param , MarkupKind format = MarkupKind . PlainText ) =>
11421142 this . Manager ( param ? . TextDocument ? . Uri ) ? . FileQuery (
11431143 param ? . TextDocument , ( file , c ) => file . HoverInformation ( c , param ? . Position ? . ToQSharp ( ) , format ) , suppressExceptionLogging : true ) ;
11441144
@@ -1151,7 +1151,7 @@ public Task ManagerTaskAsync(Uri file, Action<CompilationUnitManager, bool> exec
11511151 /// Fails silently without logging anything if an exception occurs upon evaluating the query
11521152 /// (occasional failures are to be expected as the evaluation is a readonly query running in parallel to the ongoing processing).
11531153 /// </summary>
1154- public DocumentHighlight [ ] ? DocumentHighlights ( TextDocumentPositionParams param ) =>
1154+ public DocumentHighlight [ ] ? DocumentHighlights ( TextDocumentPositionParams ? param ) =>
11551155 this . Manager ( param ? . TextDocument ? . Uri ) ? . FileQuery (
11561156 param ? . TextDocument , ( file , c ) => file . DocumentHighlights ( c , param ? . Position ? . ToQSharp ( ) ) , suppressExceptionLogging : true ) ;
11571157
@@ -1164,7 +1164,7 @@ public Task ManagerTaskAsync(Uri file, Action<CompilationUnitManager, bool> exec
11641164 /// Fails silently without logging anything if an exception occurs upon evaluating the query
11651165 /// (occasional failures are to be expected as the evaluation is a readonly query running in parallel to the ongoing processing).
11661166 /// </summary>
1167- public Location [ ] ? SymbolReferences ( ReferenceParams param ) =>
1167+ public Location [ ] ? SymbolReferences ( ReferenceParams ? param ) =>
11681168 this . Manager ( param ? . TextDocument ? . Uri ) ? . FileQuery (
11691169 param ? . TextDocument , ( file , c ) => file . SymbolReferences ( c , param ? . Position ? . ToQSharp ( ) , param ? . Context ) , suppressExceptionLogging : true ) ;
11701170
@@ -1175,7 +1175,7 @@ public Task ManagerTaskAsync(Uri file, Action<CompilationUnitManager, bool> exec
11751175 /// Fails silently without logging anything if an exception occurs upon evaluating the query
11761176 /// (occasional failures are to be expected as the evaluation is a readonly query running in parallel to the ongoing processing).
11771177 /// </summary>
1178- public SymbolInformation [ ] ? DocumentSymbols ( DocumentSymbolParams param ) =>
1178+ public SymbolInformation [ ] ? DocumentSymbols ( DocumentSymbolParams ? param ) =>
11791179 this . Manager ( param ? . TextDocument ? . Uri ) ? . FileQuery (
11801180 param ? . TextDocument , ( file , _ ) => file . DocumentSymbols ( ) , suppressExceptionLogging : true ) ;
11811181
@@ -1186,7 +1186,7 @@ public Task ManagerTaskAsync(Uri file, Action<CompilationUnitManager, bool> exec
11861186 /// Fails silently without logging anything if an exception occurs upon evaluating the query
11871187 /// (occasional failures are to be expected as the evaluation is a readonly query running in parallel to the ongoing processing).
11881188 /// </summary>
1189- public ILookup < string , WorkspaceEdit > ? CodeActions ( CodeActionParams param ) =>
1189+ public ILookup < string , WorkspaceEdit > ? CodeActions ( CodeActionParams ? param ) =>
11901190 this . Manager ( param ? . TextDocument ? . Uri ) ? . FileQuery (
11911191 param ? . TextDocument , ( file , c ) => file . CodeActions ( c , param ? . Range ? . ToQSharp ( ) , param ? . Context ) , suppressExceptionLogging : true ) ;
11921192
@@ -1197,7 +1197,7 @@ public Task ManagerTaskAsync(Uri file, Action<CompilationUnitManager, bool> exec
11971197 /// without logging anything if an exception occurs upon evaluating the query (occasional failures are to be
11981198 /// expected as the evaluation is a readonly query running in parallel to the ongoing processing).
11991199 /// </summary>
1200- public CompletionList ? Completions ( TextDocumentPositionParams param ) =>
1200+ public CompletionList ? Completions ( TextDocumentPositionParams ? param ) =>
12011201 this . Manager ( param ? . TextDocument ? . Uri ) ? . FileQuery (
12021202 param ? . TextDocument ,
12031203 ( file , compilation ) => file . Completions ( compilation , param ? . Position ? . ToQSharp ( ) ) ,
@@ -1213,7 +1213,7 @@ public Task ManagerTaskAsync(Uri file, Action<CompilationUnitManager, bool> exec
12131213 /// failures are to be expected as the evaluation is a read-only query running in parallel to the ongoing
12141214 /// processing).
12151215 /// </summary>
1216- public CompletionItem ? ResolveCompletion ( CompletionItem item , CompletionItemData data , MarkupKind format ) =>
1216+ public CompletionItem ? ResolveCompletion ( CompletionItem item , CompletionItemData ? data , MarkupKind format ) =>
12171217 this . Manager ( data ? . TextDocument ? . Uri ) ? . FileQuery (
12181218 data ? . TextDocument ,
12191219 ( _ , compilation ) => compilation . ResolveCompletion ( item , data , format ) ,
@@ -1256,7 +1256,7 @@ public Task ManagerTaskAsync(Uri file, Action<CompilationUnitManager, bool> exec
12561256 /// Note: this method waits for all currently running or queued tasks to finish
12571257 /// before accumulating the diagnostics by calling FlushAndExecute.
12581258 /// </summary>
1259- public PublishDiagnosticParams [ ] ? GetDiagnostics ( Uri file )
1259+ public PublishDiagnosticParams [ ] ? GetDiagnostics ( Uri ? file )
12601260 {
12611261 this . load . QueueForExecution (
12621262 ( ) =>
0 commit comments