-
Notifications
You must be signed in to change notification settings - Fork 417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Roslyn's editorconfig support #1771
Use Roslyn's editorconfig support #1771
Conversation
thanks a lot, this is a very welcome change! I left some small comments and just have a few questions:
|
} | ||
} | ||
|
||
private void UpdateAnalyzerConfigFiles(Project project, IList<string> analyzerConfigFiles) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this code be conditioned on editorconfig being enabled in OmniSharp?
otherwise, if you disable it, it would be respected on formatting, but the analyzer options would still apply
@@ -292,7 +306,8 @@ private ProjectInfo GetProject(CakeScript cakeScript, string filePath) | |||
metadataReferences: GetMetadataReferences(cakeScript.References), | |||
// TODO: projectReferences? | |||
isSubmission: true, | |||
hostObjectType: hostObjectType); | |||
hostObjectType: hostObjectType) | |||
.WithAnalyzerConfigDocuments(analyzerConfigDocuments); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the same should be applied here
public static ProjectInfo CreateProjectInfo(this ProjectFileInfo projectFileInfo, IAnalyzerAssemblyLoader analyzerAssemblyLoader) |
Yep, I agree
Yeah, there are a few places to update if we want to disable the analyzer part. With it being under FormattingOptions I wasn't sure the expected behavior. I'll update soon. |
@@ -377,6 +377,11 @@ private void WatchProjectFiles(ProjectFileInfo projectFileInfo) | |||
QueueProjectUpdate(projectFileInfo.FilePath, allowAutoRestore: true, projectFileInfo.ProjectIdInfo); | |||
}); | |||
|
|||
_fileSystemWatcher.Watch(".editorconfig", (file, changeType) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this watch on projectFileInfo.AnalyzerConfigFiles
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it still need a catch-all to handle new .editorconfigs being added to subfolders? I expected this would be easy way of handling Add and Update.
@@ -75,6 +75,54 @@ public async Task WhenProjectIsLoadedThenItContainsCustomRulesetsFromCsproj() | |||
} | |||
} | |||
|
|||
[Fact] | |||
public async Task WhenProjectIsLoadedThenItContainsAnalyzerConfigurationFromEditorConfig() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍👍
@@ -29,6 +29,8 @@ public static void Initialize(IServiceProvider serviceProvider, CompositionHost | |||
projectEventForwarder.Initialize(); | |||
var projectSystems = compositionHost.GetExports<IProjectSystem>(); | |||
|
|||
workspace.EditorConfigEnabled = options.CurrentValue.FormattingOptions.EnableEditorConfigSupport; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be good to also reset this flag here https://github.com/OmniSharp/omnisharp-roslyn/blob/master/src/OmniSharp.Host/WorkspaceInitializer.cs#L62-L65
this way it should be effective in real time when options change (since they are watched)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be useful if there were a way to force all the projects to update. Is this option worth all this extra complexity? I would assume the presence of an .editorconfig would be the indicator of whether a user wanted .editorconfig support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right we can solve this systematically separately as there are other areas that would benefit from that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks!
Resolves #1657