cpmcgrath / codealignment Goto Github PK
View Code? Open in Web Editor NEWHome Page: http://www.codealignment.com
Home Page: http://www.codealignment.com
Write Unit Tests for Code alignment code.
#4 will lead to the settings being stored in JSON, the defaults should be updated to be consistent.
This should not be done immediately as we don't want people to lose their settings.
Visual Studio has a toolbar which is a great way to get started. It makes sense for Notepad++ to have one too.
Tabs are evil, you know.
But I'd prefer to get this (not tabs, just spaces but more than 1):
SomeMethod(
param1: arg1,
param2: arg2, // 4 spaces.
param3: arg3)
{
// ...
}
instead of this:
SomeMethod(
param1: arg1,
param2: arg2, // 1 space.
param3: arg3)
{
// ...
}
BTW, I'm using this regular expression: :\s*(?<x>[^\s])
.
In Visual Studio 2013, if the user has the Dark Theme on, they can barely see the icon in the Extension Manager.
The MRU list can get really long and filled with garbage. Ability to reset it would be great.
remove the stroke from around the icons
The ISO keyboard layout for example has " above the 2, while the single quote is the same position.
It would seem like it's written for ANSI Keyboard Layout, should also support ISO and maybe JIS
consider the following:
Maps.addMap("Quantity", "Quantity Qualifier", "MMM-6-1");
Maps.addMap("Quantity", "Quantity", "MMM-6-2");
Maps.addMap("Quantity", "Code List Qualifier", "MMM-6-3");
None of the current options will work for lining up the code without changing the strings. If I could align by comma, or if I could align by only the leftmost quote that would help. Or if I could align by space ignoring spaces inside of strings.
Is there any solution? I really want to use the extension, but it won't work for me without doing a find/replace of comma to period and then back again :(
This also happens in Visual Studio, but the error is much more meaningful. Should add Better error handling to Notepad++ and check if the entered regex is valid as early as possible.
In the last couple of weeks I've stopped being able to use the code alignment plugin for NP++.
I get the following unhandled exception message when I try to use the align by character option:
System.IO.FileNotFoundException: Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
File name: 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
at System.Configuration.TypeUtil.GetTypeWithReflectionPermission(IInternalConfigHost host, String typeString, Boolean throwOnError)
at System.Configuration.MgmtConfigurationRecord.CreateSectionGroupFactory(FactoryRecord factoryRecord)
at System.Configuration.MgmtConfigurationRecord.EnsureSectionGroupFactory(FactoryRecord factoryRecord)
at System.Configuration.MgmtConfigurationRecord.GetSectionGroup(String configKey)
at System.Configuration.Configuration.GetSectionGroup(String sectionGroupName)
at System.Configuration.ClientSettingsStore.DeclareSection(Configuration config, String sectionName)
at System.Configuration.ClientSettingsStore.GetConfigSection(Configuration config, String sectionName, Boolean declare)
at System.Configuration.ClientSettingsStore.WriteSettings(String sectionName, Boolean isRoaming, IDictionary newSettings)
at System.Configuration.LocalFileSettingsProvider.SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection values)
at System.Configuration.SettingsBase.SaveCore()
at System.Configuration.SettingsBase.Save()
at System.Configuration.ApplicationSettingsBase.Save()
at CMcG.CodeAlignment.FormCodeAlignment.Ok(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.PerformClick()
at System.Windows.Forms.Form.ProcessDialogKey(Keys keyData)
at System.Windows.Forms.Control.ProcessDialogKey(Keys keyData)
at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
If I try to do alignment by one of the default characters like equals (the ones in the menu), it all works fine.
I'm using Windows 8.1 x64 and have the latest versions of Dot Net (4.5.1 and 4.6.1) installed and the latest versions of Notepad++ (6.9.2) and the code alignment plugin (12.0).
On another Windows 7 computer which has the same software installed, I don't have the issue.
I'm trying to work out what must have changed on my computer to make it stop working and I can't seem to figure out what has changed. The only thing I have installed since I last remember it working is the Intel OpenCL SDK, but I doubt that will be causing the issue. There haven't been any windows updates installed either, so I am really not sure what is going on.
Been told that Visual Studio 2012 Express allows extensions. Should be investigated and if true targeted.
Tabs should be for indenting, not aligning.
So this should be the default behaviour with an option to use tabs.
If you hold down ctrl during a shortcut you should be able to press the next key without pressing ctrl = again. The next alignment will always start from the position of the last alignment. This is called "Chained Alignments"
var a = b = c = d = (e - 2);
var foo = foobar = bar = buzz = (fuzzbuzz - 2);
If you press ctrl =, then hold ctrl and press ====- it could turn the above into...
var a = b = c = d = (e - 2);
var foo = foobar = bar = buzz = (fuzzbuzz - 2);
Note: This assumes you've written an alignment for -
If I add a shortcut in Visual Studio, I want that shortcut to also work in Notepad++.
I would love to see the ability to make this code...
int i = 4; // another comment
int x = 7; // some comment
int y = 5; // another comment
int myFatAssVarWithIrritatinglyLongName = 5; // a final comment
indented with an algorithm like:
1: find the longest line in selection
2: indent all code-comments to the next TAB position after the found longest line's endpoint
so the code above would similar to this instead:
int i = 4; // another comment
int x = 7; // some comment
int y = 5; // another comment
int myFatAssVarWithIrritatinglyLongName = 5; // a final comment
That would be very, very useful!
Currently the options let you customise the End of Scope selector by a space separated list of values and a space seperated list of line end values.
If there was an option to expose it as a regex (or several regexes) it would give the end use more control.
Replace "principals" with "principles"
On the website and tooltip it gets cut off at "most data using tables and spreadshee"
Would also be good to get to the point by, "other displines, code alignment giv" which is where it cuts off the description at the default extension window size (when the download button isn't visible)
Hi,
At build 2016 Microsoft released Visual Studio 15 Preview.
There are some extensions that work there, but some that are not even searchable in "Extensions and Updates". Yours is one of those that are not searchable and not installable.
Your extension is not searchable in new Visual Studio 15 Preview
Your extension should or could be also in VS15Preview :)
Btw, I created recently one analyzer and made it to be an extension and it works there fine:
https://github.com/jakubsuchybio/DebuggingUsingsInsertor-Analyzer
If you needed something to compare yours setup of extension with.
Regards.
var a = foo = 5;
var b = foobar = 10;
with the option on and without "align from caret" should become
var a = foo = 5;
var b = foobar = 10;
When the Common assembly was first created there was only one pretty simple screen. Since then a lot of screens has been added an it's start to make the Common assembly a bit messy.
By seperating the WinForms logic, not only do we get a cleaner design but we have the option to introduce different UIs (e.g. WPF) without removing the WinForms logic (Which could still be useful if ported to linux with mono).
It has been reported that on the German Keyboard layout the shortcuts "Ctrl =" and "Ctrl Shift =" don't work. You can manually update them, but it would be good to have defaults for different regions.
I can't get this plugin to work correctly in Visual Studio. I'm trying to align multiple lines with commas.
[foo, bar, baz]
[1,2,3]
Desired:
[foo, bar, baz]
[1 , 2 , 3]
The closest thing I've found is this wiki page, but when I try that regex, it doesn't do anything but align the first commas on the lines I have highlighted. I want all commas aligned.
So I have a few issues:
Thanks for any help.
Currently when you "Use IDE tab settings" with tabs on, code alignment will align exactly to the furthest instance. It does this by inserting tabs then spaces. Some people would like it to just insert tabs and move the furthest along a bit to match that.
This issue is to discuss the possibility of introducing an option - not a guarantee that it will be done. And to see if anyone would like to volunteer to implement it.
Before contributing please read https://github.com/cpmcgrath/codealignment/wiki/Tabs-&-Alignment and consider if you really want to use tabs at all.
It is centering it to the Align by key bar instead of the center of the screen. This was introduced in Version 10.
UNICODE GLYPH POINTS
… Elipsis.Alt +0133
⸘⸘ Upside-Down Interrobang.Alt +2E18
test test.test
test0 test0.test0
Aligning by space on the above causes the second line to align 2 short, and the third line to be 4 short. So each glyph is being treated as 3 characters long instead of one.
Worth noting: It seems like some fixed width fonts don't count glyphs as needing to conform to the width.
If possible this should be fixed.
It installs, then when you try to run it you get an error. The critical part of the Activity log is...
Could not load file or assembly 'Microsoft.VisualStudio.Shell.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
In short, I consider this a problem with the Lightweight installer they should fix on their side, I mainly made this issue so if people experience it they can understand why.
However, if someone knows how to fix this (While keeping compatibility with old versions of Visual Studio!) more than happy to accept a pull request.
One solution is to move everything to WPF. The other is to provide different scaling for each image
Not sure how useful this would be. Feedback welcome.
Alignment Regex's have the
(?) Match Group.
This will not change, but the following enhancements should be made.
(?) Match Group should have an alias (?)
compare is the preferred syntax as it's more descriptive.
A new matching group (?) which defines where the spaces should be inserted. If it doesn't exist it should then use compare/x then the start of the matching regex.
Tabs should be used for aligning because 1 character vs 4/5 characters over 10s of thousands of lines will increase file-size. Using this plugin to 13961 lines won't allow me to use my save macro ( which converts 5 spaces to tab, 4 spaces to tab, 3 spaces to tab, 2 spaces to tab, and trim trailing white-space ) because of the spaces-spam...
The file I'm editing is 690kb when using tabs as aligners. However, when using spaces as aligners from this plugin made the file size 1,731KB... Over 1.1mb of just SPACES which is stupid. Yes, stupid because there are more spaces in the document than content whereby if using tabs the content would still outweigh tab content by more than 2 times.
I don't see why the option doesn't exist, and why it was edited in 2012 to remove the option to use tabs if the user wants: f79b6c7
If you edit a line which has an alignment on it, there's a good chance that this will break the alignment. Doing the alignment again fixes it but can add too much white space. For example,
var distanceTravelled = 10;
var x = 5;
And then we decide to improve the name of x
var distanceTravelled = 10;
var xCoordinate = 5;
And then we do an alignment
var distanceTravelled = 10;
var xCoordinate = 5;
There should be a way to remove the excess white space...
var distanceTravelled = 10;
var xCoordinate = 5;
There should be an option to continue aligning until it can't find anything more to align.
var a = b = c = d = e;
var foo = foobar = bar = buzz = fuzzbuzz;
With the option with a single shortcut, should become
var a = b = c = d = e;
var foo = foobar = bar = buzz = fuzzbuzz;
The purpose of this is to allow code alignment to skip lines. If you have
int value1;
//Something about value2
string value2;
and you want to use align by space to align the variable names you end up with
int value1;
//Something about value2
string value2;
This option would let the center line be ignored.
We may also proved an option on the Align by screen to ignore this or not.
Finally, this will only skip whole lines, not part of lines after the specified condition. So it would not stop
int foo; //comment after code
var valueone = 64;
var valuetwo = 64;
becoming
int foo; //comment after code
var valueone = 64;
var valuetwo = 64;
It might be possible to do this in a similar way to Sublime. But I plan on porting the entire Code Alignment code to Javascript for this.
This will hopefully mean the code base could be used with many more IDEs.
Since it is bad practice to remove a users shortcut without notice, the best solution would be on startup to show a screen which asked if they wanted the shortcut changed and automatically do it for them.
I'd like to format this:
int[] Numbers = {
1, 2, 3,
4 , 5 , 6 ,
7 , 8 , 9
}
like this:
int[] Numbers = {
1, 2, 3,
4, 5, 6,
7, 8, 9
}
So far the only way to do it is to move the caret and align again which become a hassle with a lot of columns. Regular expressions didn't seem to work.
Usage scenarios:
TextFX can handle all of them as long as Unicode is not involved but I've had it insert 4k spaces in some instances when parsing server logs.
Currently a block is defined as the area between lines which just contain one of the following sets of characters
{ } }; ( )
This option would allow a user to add and remove from this list. They should also be a second list where instead of the line equaling the list it only has to end in it. This is useful for people who don't put { on new lines.
At the moment the logic states get the first instance of a line with the delimiter at furthest right. If this first instance has a space before it, it will not add another space - even if another line with the same delimiter position requires it.
The Restore to default for the XML types crashes (and doesn't restore the default)
This is the behaviour with Align by key. It should not cause "Align from caret position" to be ticked next time. As that could force you to have to untick it.
Hi,
Previously up until today I would highlight a bunch of properties in a C# file, press Ctrl+Shift+= to 'Align By Key' and then press '{' to align them as follows:
public bool Failed { get; private set; }
public string FailureMessage { get; private set; }
public string ExceptionInfo { get; private set; }
public string ErrorInfo { get; private set; }
This morning this appears to no longer work. I get the "Waiting for second key chord.." pop up (which I'm sure I never saw before..) and pressing the '{' key does nothing. It works if I align by equals, or AlignBykey and then '=', and I can't see any updates or anything newly installed in VS2013 that would have broken this.
Any thoughts? It's very frustrating as using this extension has been wonderful and is now more of a habit than anything.
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.