Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Roslyn analyzers and code fixes #1076
Roslyn analyzers and code fixes #1076
Changes from 219 commits
b42ac37
d2f872f
d366b61
b374a3f
6ce7e66
cc8f251
978fbdd
80801ed
3ec70fd
1bbd78e
e168896
e3ad473
23e47ee
4976660
86d197a
544aec8
dc527fb
68fef87
e11d11b
9070f09
5adf1a1
1d79739
fa2721e
21c670c
7ec5cf0
f0b4e2a
a8e388a
177c41b
2d0c255
1e607cc
21f91c3
b60d5b0
8cc9ad2
bfe05ad
371271d
7ed7702
b51d8f5
51d0048
3989685
4986456
8511611
a62fdc0
786cbab
bc6c9ef
1297a62
44f79ab
19ee0ea
9e83c60
b32b04d
4844226
7ae79b0
a06ddb6
0db9e4f
f10fa7b
910a365
f4b829c
00da2a9
405b2bd
014865a
2dc672c
b0242ce
bf38248
9d7e2ae
44949a2
b3654d4
b6210f0
bf9db1c
74b6046
636a02f
ee18d0f
bf89628
8594fe8
6575055
85d424f
871c1d7
32b0c85
2ec0450
39e33ec
65837a9
fa9f660
55cf797
4233203
e5ef6b3
c5c92f0
3aaf770
0e59d1b
5b9b265
902cfe1
3e9ec2a
4989125
16ef3bb
2360ee2
ec0e520
28a9118
f32c8e7
abea526
6ff3af8
b33dd60
d4e7a6e
51359b4
862d8de
f64738d
e761e87
9c25d64
24f08b1
1c3c989
a0f5258
0f41ea5
e25d686
bf154f9
2e10c35
9028a01
41ccefc
164bae4
02ca6cb
39e3bdc
f635588
a6f825b
f210d14
f8cce2d
dbab30c
be8f23e
9cca424
9f64935
ffe8e8a
ed82a59
ed29a61
e25e934
c4dfc19
21018b9
c322d46
336a799
acb954f
a734c16
6aea8d1
eba7ca5
bb93520
c33d8f3
c34f554
c9548f6
42a939a
7c7d85a
3cab565
8b538a2
de7426e
633555b
5295e9b
81d743a
baa2113
ffce204
08276f1
b4a656d
e69334e
ee55e0d
ea54463
047d5ed
6528518
180b979
7ad625c
8b1b499
5e1ab8c
c8a59ba
4e21965
bb5a896
b22d717
2d0a7af
6bfb484
1f0f347
d8c98fe
d37af46
3ebb4fd
6bd21bb
4ac48b9
6ce28fc
eb313dd
d5b69d2
6034988
42ec450
65c1398
0384bc7
d6b8e8f
f69ffc7
17854f5
475bcef
421ef74
f074e79
80eb9dd
afe1ad6
1ee7372
ff9e72b
cdb30d0
5e049b1
e423278
589512d
5e11541
a3e11d0
3c8a471
242a28b
2cd0183
8eeabdf
811cbd9
5dac0aa
9b4b1f0
ad38560
50f25c5
be71dd7
e38e73e
b251e24
342a140
a2f8a63
5edc6de
751f3c5
856e40e
4753e64
ce0358c
f886c8b
dd98cfe
05c8ed5
da6089d
e0c2590
8afa925
76cba87
1d3965a
fd9dc51
4e4d01c
01cafcb
2a0cb3e
0c28cbb
4250f38
2b11dd7
2d81bda
1c83919
cbc81e5
ce6ca69
3e7edf8
4c49a96
7e4b77c
ab42b95
583d68a
5abc746
5ab1836
d15427c
640a968
849bf32
9b635c9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
so this doesn't shadow copy the dlls? will it lock those files? see this - http://source.roslyn.io/#Microsoft.VisualStudio.LanguageServices/InternalUtilities/ShadowCopyAnalyzerAssemblyLoader.cs,95af99de7a518139,references
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.
As far as i understand no, it should have flag enabled for shadow copying, however everything seems to work fine with this version, can @DustinCampbell open how current loader solution works from end to end (lifetime eg)?
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.
why do we need to add this, if it already exists as
public Assembly LoadFrom(string assemblyPath, bool dontLockAssemblyOnDisk = false)
? I would suggest to not proliferate these methods if they just call each otherThere 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.
the initial implementation might not need it but you probably want to support editorconfig as well since that can change some of built-in roslyn analyzers behavior if you want to have the same experience as in VS.
we are working on to make it automatically picked up by Roslyn, so you could just wait until then for editorconfig work (so that msbuild has editorconfig info in it like Analyzers) and you can build roslyn solution with that info like what you are doing with AnalyzerFileReference and CompilationOptions. and then after that CompilationWithAnalyzer takes care of all the detail once context is setup right.
until then, if you want to support editorconfig, you have to do it yourself. let me know if you want to, it is a bit of work depends on what infrastructure you have on editorconfig.
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.
in simple term, you need to set up http://source.roslyn.io/#Microsoft.CodeAnalysis.EditorFeatures.Wpf/Options/EditorConfigDocumentOptionsProvider.cs,19 in your workspace.
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.
@heejaechang do you know when roslyn integrated solution will be released? Not exact timing but like is it upcoming month or maybe year away?
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.
@savpek can't say for sure. but we are actively working on. we recently checked in changes in compiler layer. and I believe we are working on to make it work on roslyn workspace layer. and then features and etc.
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.
we also have the possibility of loading code refactorings via global configuration https://github.com/OmniSharp/omnisharp-roslyn/blob/master/src/OmniSharp.Abstractions/Options/RoslynExtensionsOptions.cs#L10.
At the moment only refactorings work this way, but not analyzers - it would make sense to include assemblies discovered this way in analyzers
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.
If i remember correctly (implemented like 6 months back 🙂 ) it should be in current version:
_providers is implementation of ICodeActionProvider which is extended to support analyzers and code fixes.
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.
ah you are right, brilliant 👍the PR is difficult to view on github at this point 😄
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.
How is this used differently than the logic in CachingCodeFixProvider to load analyzers?
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.
Code fixes and analyzers can come from same assemblies, but analyzers are given to Project object and CodeFixes are cached elswhere since project doesn't have any information about it's CodeFixes available at model itself. This has same assembly ref part but after that they are different, extension method creates AnalyzerFileReference that are handled by roslyn internally and codeFixes per project are fetched from this cache. I am not 100% sure is there some other way to do this but it seems roslyn doesn't expose means for it at this point. If i remember correctly there are kind of similar mechanism inside of roslyn source code, however this memory goes almost year back so who knows 🙂 I think this is something which can be refactored if better means show up.