message: Convert most has + gets to just gets
diff: @@ -11,7 +11,7 @@ import { OmniSharpServer } from '../omnisharp/server';
  export default class SourceGeneratedDocumentProvider implements TextDocumentContentProvider, IDisposable {
  readonly scheme = "omnisharp-source-generated";
  - private _registration: IDisposable;
  + private _registration?: IDisposable;
  private _documents: Map<SourceGeneratedFileInfo, SourceGeneratedFileResponse>;
  private _uriToDocumentInfo: Map<string, SourceGeneratedFileInfo>;
  private _documentClosedSubscription: IDisposable;
  @@ -30,21 +30,21 @@ export default class SourceGeneratedDocumentProvider implements TextDocumentCont
  private async onTextDocumentClosed(document: TextDocument) {
  const uriString = document.uri.toString();
  - if (this._uriToDocumentInfo.has(uriString)) {
  const info = this._uriToDocumentInfo.get(uriString);
  + if (info !== undefined) {
  this._documents.delete(info);
  this._uriToDocumentInfo.delete(uriString);
  await serverUtils.sourceGeneratedFileClosed(this.server, info);
  }
  }
  - private async onVisibleTextEditorsChanged(editors?: TextEditor[]) {
  + private async onVisibleTextEditorsChanged(editors: readonly TextEditor[]) {
  for (const editor of editors) {
  const documentUri = editor.document.uri;
  const uriString = documentUri.toString();
  - if (this._uriToDocumentInfo.has(uriString)) {
  - try {
  const existingInfo = this._uriToDocumentInfo.get(uriString);
  + if (existingInfo !== undefined) {
  + try {
  const existingResponse = this._documents.get(existingInfo);
  const update = await serverUtils.getUpdatedSourceGeneratedFile(this.server, existingInfo);
  if (!update) {
  @@ -75,15 +75,16 @@ export default class SourceGeneratedDocumentProvider implements TextDocumentCont
  }
  public dispose() {
  - this._registration.dispose();
  + this._registration?.dispose();
  this._documentClosedSubscription.dispose();
  this._visibleTextEditorsChangedSubscription.dispose();
  this._documents.clear();
  }
  public tryGetExistingSourceGeneratedFile(fileInfo: SourceGeneratedFileInfo): Uri | undefined {
  - if (this._documents.has(fileInfo)) {
  - return this.getUriForName(this._documents.get(fileInfo).SourceName);
  + const sourceName = this._documents.get(fileInfo)?.SourceName;
  + if (sourceName !== undefined) {
  + return this.getUriForName(sourceName);
  }
  return undefined;
  @@ -91,8 +92,9 @@ export default class SourceGeneratedDocumentProvider implements TextDocumentCont
  public addSourceGeneratedFileWithoutInitialContent(fileInfo: SourceGeneratedFileInfo, fileName: string): Uri {
  if (this._documents.has(fileInfo)) {
  - // Raced with something, return the existing one
  - return this.tryGetExistingSourceGeneratedFile(fileInfo);
  + // Raced with something, return the existing one.
  + // Bang is validated via has.
  + return this.tryGetExistingSourceGeneratedFile(fileInfo)!;
  }
  const uri = this.getUriForName(fileName);
  @@ -114,7 +116,7 @@ export default class SourceGeneratedDocumentProvider implements TextDocumentCont
  const fileInfo = this._uriToDocumentInfo.get(uri.toString());
  let response = this._documents.get(fileInfo);
  - if (response === null) {
  + if (response === undefined) {
  // No content yet, get it
  response = await serverUtils.getSourceGeneratedFile(this.server, fileInfo, token);
  this._documents.set(fileInfo, response);
  