editorconfig / editorconfig-visualstudio Goto Github PK
View Code? Open in Web Editor NEWEditorConfig Visual Studio Addin
Home Page: http://editorconfig.org
License: Other
EditorConfig Visual Studio Addin
Home Page: http://editorconfig.org
License: Other
After opening a project without a .editorconfig file i'm getting an error from VisualStudio, after checking the ActivityLog.xml file I found the following error:
662 2015/08/26 14:28:33.116 ErrorHave tried removing and reinstalling the addon and the error persists.
It'd be nice if the VS plugin supported the "charset" property.
Hello,
I originally downloaded the roslyn / .editorConfig file and found it caused this extension to crash and opened this issue: dotnet/roslyn#17914
From that discussion it sounds like [.cs] should be a valid file filter.
Steps to Reproduce:
Install the EditorConfig extension for VS 2015
Place the roslyn / .editorconfig file in the solution folder
Open the solution in VS 2015
Expected Behavior:
Visual studio doesn't crash due to the missing curly braces in the [.cs] file type filter under the CSharp code style settings: section. The file filter [.cs] should be [*.{cs}]
Actual Behavior:
Microsoft Visual Studio 2015 has stopped working
I did some digging, it seems that the new refactored version and Paul Betts' extension SaveAllTheTime are conflicting.
SaveAllTheTime calls Save periodically / after certain changes. This causes the new version to react to the save event, and apply various transformations on the content, sometimes this applies an old version, replacing the changes. Sometimes this happens in mid typing, causing intellisense (and various other open popup windows, like ReSharper's Alt-Enter) to disappear.
I haven't investigated myself a potential solution yet, but I have disabled SaveAllTheTime at the moment. Will see what to do about it...
Hi Dear Developer,
I am looking for a way to mark // to do in the code as warning.
Ex:
void GetInfoFromAPI()
{
// to do - Call Azure DevOps API
}
This should be marked as a "warning". Please suggest me.
Hello,
i want a rule to make the first word in lower of my method/function names.
I have this block of code:
#method names first word lower
dotnet_naming_rule.functions_should_be_camel_case.severity = warning
dotnet_naming_rule.functions_should_be_camel_case.symbols = functions
dotnet_naming_rule.functions_should_be_camel_case.style = function_style
dotnet_naming_symbols.functions.applicable_kinds = method
dotnet_naming_symbols.functions.required_modifiers = *
dotnet_naming_symbols.functions.applicable_accessibilites = *
dotnet_naming_style.function_style.capitalization = camel_case
But it's not working. What am i doing wrong ? Please help.
System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component. at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at Microsoft.VisualStudio.Shell.Design.Serialization.DesignerDocDataService.Microsoft.VisualStudio.Shell.Interop.IVsRunningDocTableEvents.OnBeforeLastDocumentUnlock(UInt32 docCookie, UInt32 lockType, UInt32 readLocksRemaining, UInt32 editLocksRemaining) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at Microsoft.VisualStudio.Shell.Design.Serialization.DesignerDocDataService.Microsoft.VisualStudio.Shell.Interop.IVsRunningDocTableEvents.OnBeforeLastDocumentUnlock(UInt32 docCookie, UInt32 lockType, UInt32 readLocksRemaining, UInt32 editLocksRemaining) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at System.Runtime.InteropServices.CustomMarshalers.EnumerableViewOfDispatch.GetEnumerator() at System.Collections.IEnumerable.GetEnumerator() at System.Linq.Enumerable.d__921.MoveNext() at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable
1 source, Func`2 predicate) at EditorConfig.VisualStudio.Logic.Cleaning.InitialCleanup..ctor(ITextDocument textDocument, _DTE ide, FileConfiguration settings) at EditorConfig.VisualStudio.Logic.Settings.TextViewMonitor.ViewOnGotAggregateFocus(Object sender, EventArgs eventArgs) at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.RaiseEvent(Object sender, EventHandler eventHandlers)
Now, after VS2017 release, we can see what have been done there, and what haven't been done.
I have been using EditorConfig for Visual Studio to consistently set the following properties on my projects:
[*]
charset = utf-8 # that means without BOM
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
VS2017 doesn't support charset = utf-8
(and forces the BOM all the way), nor insert_final_newline
neither trim_trailing_whitespace
, and that causes mess in my sources. The kind of mess I'd like to exterminate.
I think that embedded EditorConfig support in VS2017 isn't very useful in its current state, and I'd like the plugin to be resurrected and released for VS2017.
Hello!
I installed editorconfig in Visual Studio 2015, but it is not shown in the [Add New Item] in Visual Studio 2015.
Do you have any way?
In the current version on master, doing any refactorings with resharper often introduces mixed or bad indentation. This is due to the more aggressive unloading of settings.
I just fixed a fairly big merge conflict with VS 2015's built-in Git merge conflict resolving thing (i.e. the thing where you see the changes in the base branch at the top left, the changes in the target branch at the top right, and the combined file at the bottom). This involved manually rewriting some lines instead of picking an existing version of them from one of the existing branches. Upon finishing the merge commit, I realised that the lines I'd rewritten now had the wrong indentation type.
This is with the 5.0.0 release, so it's not impossible that it's been resolved in an unreleased build.
I am very confused as to which issue tracker should be used; the one on this repository,
or the one on the editorconfig repository which has a vs-plugin label and is pointed to by the README in this repository.
If both had all tickets that maybe would have been less of a problem, but I see ticket comments pointing to the other tracker to an issue that is not in the other.
IIRC you can disable the issue tracker on repositories, so I would suggest dropping one for the other.
If need be, there is also a (manual) migration path for existing tickets (prepare JSON data for github stuff and send it to them).
As it currently is, its confusing, potentially redundant, more for to maintain, and harder to search.
more than a year w/o updates :(
I was just going over the release notes of VS 2017 and noticed this:
New in RC Visual Studio editor now supports EditorConfig, which allows developers to define and maintain consistent coding style conventions between different editors and IDEs. See known issues for a list of known limitations in EditorConfig support in this RC release.
I suppose that this extension will be deprecated then in favour of the built-in support? Either way, thanks for all the work so far, since it probably encouraged Microsoft to add built-in support :)
I have written my own .editorconfig with the help with
https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
I have set every entry listed on this page.
The .editorconfig works fine with VS2017.
But will cause VS2015 crash with EditorConfig plugin installed. Whenever I open a editor, VS2015 crashes.
Last version of editorconfig 0.5.0 was released to vs marketplace in Oct 2014. Since then a lot of fixes were made that didn't made to the end users. We are specifically interested in #44.
For now, we're going to distribute your extension manually to our end-users but it would be nice if you could release the latest version on the store. Thanks!
Using Visual Studio 2015 with the bleeding edge version of the extension.
I understand that the global settings are reset when focus is lost, but I don't understand why it has a visual effect on open files.
.editorconfig
at solution level
root = true
[*]
charset = utf-8
indent_size = 4
indent_style = tab
tab_width = 4
end_of_line = crlf
insert_final_newline = false
trim_trailing_whitespace = true
When the text editor has focus:
When the text editor does not have focus:
The actual file content is as you see it when it has focus, but it's confusing to see the indentation change.
I've seen in the code that for certain functions to work properly the application's global editor settings must be changed for the currently focused document. I haven't seen any code that restores these settings though. The EditorConfig website states that anything unspecified in the .editorconfig file is handled as configured by the user. This fallback configuration seems to be irreversibly manipulated as soon as a document is opened that is under control of a .editorconfig file.
Did I miss something or is the restoration of modified settings really missing? If not, maybe a note could be added to the ApplyGlobalSettings method.
Using Visual Studio 2015 with the bleeding edge version of the extension.
When trying to use the Quick Actions menu, either via the lightbulb icon or via the shortcut, Visual Studio gets stuck in some kind of loop where the lightbulb icon flickers. The only way to get rid of it is by forcibly closing Visual Studio.
.editorconfig
at solution level
root = true
[*]
charset = utf-8
indent_size = 4
indent_style = tab
tab_width = 4
end_of_line = crlf
insert_final_newline = false
trim_trailing_whitespace = true
e.g Add > Class
will open a file with the default indentation settings
Just what it says.
How can I resolve the error "The parameter is incorrect. (Exception from HRESULT: 0x80070057(E_INVALIDARG))"?
I selected Add->.editorconfig file and this error message came out.
How do you create a file extension filter for sub types in a vue template?
Ex: In a vue template, there is the actual html template area, a script area, and a style area. Our normal styling rules are for js/ts content to be space indented at 2, and css/less/sass to be space indented at 4. But we cannot tell how to create the filter in the editorconfig to apply them to each as they are supposed to be, only to the entire file.
I noticed that if I open 2 VS instances in parallel, each loading a project with different .editorconfig
settings, the last VS instance to open "wins", by overriding the global settings.
Now, I suppose VS settings are global, which is why this is happening. Perhaps it's worth spiking a workaround for this (by cloning the settings at runtime, or something similar...)
Newbie here. I'm not sure if this is a bug or to be expected. I'm using the latest version 0.5.0 with VS2015.
I set up a .editorconfig file like this for a cpp project. My default setting is 2 spaces for indents.
root = true
[*]
indent_style = space
indent_size = 4
So I open the project with the .editorconfig and it changes the indent to 4. Now I switch back to the other project using open recent and the indent size is still 4 spaces. I was expecting it to switch back to an indent size of 2. Anyone have any insight?
indent_style only flips the value in visual studio settings. I feel like it should automatically change the file from spaces to tabs upon save.
I do not know if it worked correctly before but currently with this config
# This file is for unifying the coding style for different editors and IDEs. # EditorConfig http://EditorConfig.org # In VisualStudio use the EditorConfig extension - https://visualstudiogallery.msdn.microsoft.com/c8bccfe2-650c-4b42-bc5c-845e21f96328 # top-most EditorConfig file root = true # unix style line endings with a newline ending every file # Line-ending will interact with git line ending transformation processing [*] indent_style = space indent_size = 4 end_of_line = lf insert_final_newline = true charset = utf-8 trim_trailing_whitespace = true [Makefile] indent_style = tab #[{package.json,.travis.yml}] #indent_size = 2
If I create edit and save a new txt file file (in git for windows) says it is
TextFile2.txt: ASCII text, with CRLF line terminators
not LF line endings
if I insert áá it becomes ISO-8859 not UTF-8
I cannot reproduce this now but I had a package.json
that was somehow listed in solution explorer but not part of the project. I can't figure how to get a file into that state again
When I saved the file I got a VS crash everytime. EditorConfig was the only extension I had added that was enabled.
Feel free to close thais a not reproducible. I wanted to log it.
We are trying to conditionally add an editoconfig to our projects. Our first idea was the possibility of adding the editorconfig at the project level under an MSBuild variable. If the condition was met, the editorconfig file (located in another folder) was added as a link to the project.
Example of adding editorconfig at the project level on demand:
<ItemGroup Condition=” $(AnalyzeAutoGeneratedCode) == ‘true’ “>
Since it doesn't work at the project level, we thought we'd add the editorconfig at the solution level. The problem is that we don't know how to add it conditionally.
Our intention would be to include an editorconfig file at the solution level that contains these exclusions, but that depends on some MSBuild variable to be able to configure it according to the needs of the programmers:
If (someVariable) # this code is the one we would like to add.
[/fakes/.cs]
dotnet_diagnostic.S1128.severity = none
dotnet_diagnostic.cs1591.severity = none
endif # this code is the one we would like to add.
Is there any way to do this?
root = true
[*]
end_of_line = crlf
charset = utf-8
insert_final_newline = true
indent_style = space
trim_trailing_whitespace = true
; 4-column space indentation
[*.{cs,js,ts,html,cshtml,aspx}]
indent_style = space
indent_size = 4
tab_width = 4
; 2-column tab indentation
[*.{xml,props,config,css,less}]
indent_style = space
indent_size = 2
tab_width = 2
indent style is ignored for cshtml files
Note: moved from editorconfig/editorconfig#217.
Given the following configuration file:
.editorconfig
root = true
[*]
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
And the following sample file (deliberately unformatted):
sample.html (original)
<!DOCTYPE html>
<html>
<head>
<title>Lorem ipsum</title>
</head>
<body>
<p>Lorem ipsum dolor sit amet.</p>
</body>
</html>
When I open this file in Visual Studio 2013 and do Edit > Advanced > Format Document (Ctrl+E, D), the document is indented to four spaces, seemingly ignoring the .editorconfig
file:
sample.html (Visual Studio 2013)
<!DOCTYPE html>
<html>
<head>
<title>Lorem ipsum</title>
</head>
<body>
<p>Lorem ipsum dolor sit amet.</p>
</body>
</html>
On the other hand, when I do the same thing in Visual Studio 2012, the document is indented properly:
sample.html (Visual Studio 2012)
<!DOCTYPE html>
<html>
<head>
<title>Lorem ipsum</title>
</head>
<body>
<p>Lorem ipsum dolor sit amet.</p>
</body>
</html>
If it matters, this is the version of Visual Studio 2013 I use:
Microsoft Visual Studio Community 2013
Version 12.0.31101.00 Update 4
And this is Visual Studio 2012:
Microsoft Visual Studio Professional 2012
Version 11.0.61030.00 Update 4
I'm running EditorConfig 0.5.0 on both.
Note that this might be related to editorconfig/editorconfig#191, though I am not 100% sure.
ReSharper uses the Visual Studio editor for various windows, such as the Stack Trace Explorer. When showing one of these windows, the Error List window pops up, showing an error of EditorConfig core error: Input file must be a full path name
.
Can EditorConfig not report an error if the document is in-memory, rather than a physical file?
and crashes visual studio
Editorconfig doesn't apply my .editorconfig
whitespace settings when I'm creating a new file. And it doesn't correct erroneous whitespace on save either.
This kind of defeats the purpose of using editorconfig, as I still have to configure all the whitespace settings manually in Tools > Options > Text editor to make sure that visual studio (2015) creates new files with the correct indentation. Is it possible to apply .editorconfig
whitespace settings when creating a new file as well? Otherwise it doesn't really make sense to use this plugin.
From time to time, Editorconfig crashes with a core error on files named like StackTractExplorerEditor.Bozepih when compiliong. The extension name may vary. The file comes from Resharper, but I am not able to see it afterwards. It seems to be a temporary file.
Visual Studio 2015 - Update 1.
Restart of Visual Studio is required to clear it, repeated compilations causes same error.
Hello,
I installed the extension from visual studio gallery in VS2015. However, it doesn't apply settings specified in the .editorconfig file.
I checked with command line editorconfig and it correctly finds and interprets my editorconfig file.
editorconfig.exe was v12.0.
I decided to build from sources, went into the debugger. ec_fnmatch doesn't find any match. Then found that the core is bound to v11.5, so updated core to v12.0.
This brought in a dependency to PCRE library which I resolved with some hacks.
Rebuild and tested again, working.
So I think, the v11.5 core has a bug.
I found the push request with a rework with core-net, installed it and it is working.
So it would be nice to integrate the core-net and update the VS gallery item.
Thanks so far,
When I modify a setting in Visual Studio that modifies the project file (<something>.csproj
), that file is saved without a final newline, even though my .editorconfig
contains insert_final_newline = true
.
Since I occasionally edit the file outside of Visual Studio, my current workaround is to disable the final newline for the project file, but it would be nice to not have to do this.
Does not work:
# Xml config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2
Works (found the limit to be this length):
# Xml config files
[*.{props,targets,ruleset,config,nuspec,resx,vsix}]
indent_size = 2
I don't know if this is a limitation or bug in the editor or the whole plug-in, but specifying utf-16le
or utf16-be
results in a warning in the Error List that the value is not support for charset
. This feature would actually be necessary to properly support .rc and .rc2 files in our projects as Visual Studio normally encode them as UTF-16LE.
One example: opening https://github.com/dotnet/roslyn/blob/32a8f40cec5d917a1356d694c6d0310ce502d5ee/src/Compilers/CSharp/Portable/Symbols/MissingMetadataTypeSymbol.cs as a single file (not csproj) from local filesystem.
Unhandled exception at 0x1DCC1F76 (EditorConfigWrapper.dll) in devenv.exe: Stack cookie instrumentation code detected a stack-based buffer overrun.
> EditorConfigWrapper.dll!1dcc1f76() Unknown
mscorlib.ni.dll!57d60156() Unknown
[Frames below may be incorrect and/or missing, native debugger attempting to walk managed call stack]
mscorlib.ni.dll!57d60156() Unknown
mscorlib.ni.dll!57d60156() Unknown
mscorlib.ni.dll!57d6010f() Unknown
mscorlib.ni.dll!57d6000a() Unknown
EditorConfigWrapper.dll!1dcc4c0e() Unknown
EditorConfigWrapper.dll!1dcc49ce() Unknown
EditorConfigWrapper.dll!1dcc3f73() Unknown
1dc377d5() Unknown
1dc371f4() Unknown
1dc3484a() Unknown
1dc33f94() Unknown
Microsoft.VisualStudio.Platform.VSEditor.ni.dll!6b0486d3() Unknown
Microsoft.VisualStudio.Platform.VSEditor.ni.dll!6b03fad5() Unknown
Microsoft.VisualStudio.Platform.VSEditor.ni.dll!6b04825d() Unknown
Microsoft.VisualStudio.Platform.VSEditor.ni.dll!6b0414cb() Unknown
Microsoft.VisualStudio.Platform.VSEditor.ni.dll!6b040ec8() Unknown
Microsoft.VisualStudio.LanguageServices.ni.dll!11db2339() Unknown
Microsoft.VisualStudio.LanguageServices.ni.dll!11d9acf0() Unknown
Microsoft.VisualStudio.Shell.Interop.ni.dll!5dbddbae() Unknown
clr.dll!5e8cee9c() Unknown
clr.dll!5e9c4028() Unknown
02a2d060() Unknown
06643fac() Unknown
0053611c() Unknown
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.