提交 6c35eed8 编写于 作者: J JieCarolHu

readonly, updated comments

上级 589ec3c9
......@@ -129,13 +129,13 @@ public int OnAfterAttributeChangeEx(uint docCookie, uint grfAttribs, IVsHierarch
// 2) the old file was a different extension that we weren't tracking, which may have now changed
if (TryUntrackClosingDocument(docCookie, pszMkDocumentOld) || TryGetLanguageInformation(pszMkDocumentOld) == null)
{
// Add the new one, if appropriate.
// Add the new one, if appropriate.
TrackOpenedDocument(docCookie, pszMkDocumentNew);
}
}
// When starting a diff, the RDT doesn't call OnBeforeDocumentWindowShow, but it does call
// OnAfterAttributeChangeEx for the temporary buffer. The native IDE used this even to
// When starting a diff, the RDT doesn't call OnBeforeDocumentWindowShow, but it does call
// OnAfterAttributeChangeEx for the temporary buffer. The native IDE used this even to
// add misc files, so we'll do the same.
if ((grfAttribs & (uint)__VSRDTATTRIB.RDTA_DocDataReloaded) != 0)
{
......@@ -200,7 +200,7 @@ private void TrackOpenedDocument(uint docCookie, string moniker)
return;
}
// We don't want to realize the document here unless it's already initialized. Document initialization is watched in
// We don't want to realize the document here unless it's already initialized. Document initialization is watched in
// OnAfterAttributeChangeEx and will retrigger this if it wasn't already done.
if (_runningDocumentTable.IsDocumentInitialized(docCookie) && !_docCookieToWorkspaceRegistration.ContainsKey(docCookie))
{
......@@ -354,8 +354,8 @@ private ProjectInfo CreateProjectInfoForDocument(string filePath)
var languageServices = Services.GetLanguageServices(languageInformation.LanguageName);
var compilationOptionsOpt = languageServices.GetService<ICompilationFactoryService>()?.GetDefaultCompilationOptions();
// We only have one code file without project file here, so we cannot find out language version of the project
// Use latest language version which is more permissive. https://devdiv.visualstudio.com/DevDiv/_workitems/edit/575761
// Use latest language version which is more permissive, as we cannot find out language version of the project which the file belongs to
// https://devdiv.visualstudio.com/DevDiv/_workitems/edit/575761
var parseOptionsOpt = languageServices.GetService<ISyntaxTreeFactoryService>()?.GetDefaultParseOptionsWithLatestLanguageVersion();
if (parseOptionsOpt != null &&
......@@ -372,7 +372,7 @@ private ProjectInfo CreateProjectInfoForDocument(string filePath)
var baseDirectory = PathUtilities.GetDirectoryName(filePath);
// TODO (https://github.com/dotnet/roslyn/issues/5325, https://github.com/dotnet/roslyn/issues/13886):
// TODO (https://github.com/dotnet/roslyn/issues/5325, https://github.com/dotnet/roslyn/issues/13886):
// - Need to have a way to specify these somewhere in VS options.
// - Use RuntimeMetadataReferenceResolver like in InteractiveEvaluator.CreateMetadataReferenceResolver
// - Add default namespace imports, default metadata references to match csi.rsp
......
......@@ -15,7 +15,7 @@ namespace Microsoft.CodeAnalysis.CSharp
[ExportLanguageServiceFactory(typeof(ISyntaxTreeFactoryService), LanguageNames.CSharp), Shared]
internal partial class CSharpSyntaxTreeFactoryServiceFactory : ILanguageServiceFactory
{
private static CSharpParseOptions _parseOptionWithLatestLanguageVersion = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.Latest);
private static readonly CSharpParseOptions _parseOptionWithLatestLanguageVersion = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.Latest);
public ILanguageService CreateLanguageService(HostLanguageServices provider)
{
......
......@@ -14,7 +14,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Partial Friend Class VisualBasicSyntaxTreeFactoryServiceFactory
Implements ILanguageServiceFactory
Private Shared _parseOptionsWithLatestLanguageVersion As VisualBasicParseOptions = VisualBasicParseOptions.Default.WithLanguageVersion(LanguageVersion.Latest)
Private Shared ReadOnly _parseOptionsWithLatestLanguageVersion As VisualBasicParseOptions = VisualBasicParseOptions.Default.WithLanguageVersion(LanguageVersion.Latest)
Public Function CreateLanguageService(provider As HostLanguageServices) As ILanguageService Implements ILanguageServiceFactory.CreateLanguageService
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册