Skip to content

Commit

Permalink
V3.3.6 2017/01/06 [Stable]
Browse files Browse the repository at this point in the history
- Added tag [env:X].
  • Loading branch information
mayerwin committed Jan 7, 2017
1 parent 0a96e91 commit 684ad23
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
12 changes: 10 additions & 2 deletions RenameVSWindowTitle/RenameVSWindowTitlePackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,8 @@ private string GetPattern(string solutionFp, bool useDefault, SettingsSet settin
"hgBranchName",
"workspaceName",
"workspaceOwnerName",
"vsProcessID"
"vsProcessID",
"env:X"
};

readonly Regex TagRegex = new Regex(@"\[([^\[\]]+)\]", RegexOptions.Multiline | RegexOptions.Compiled);
Expand Down Expand Up @@ -532,7 +533,7 @@ internal string GetNewTitle(Solution solution, string pattern, SettingsSet cfg)
return string.IsNullOrEmpty(path) ? windowName : path;
case "parentPath":
return GetParentPath(pathParts, cfg?.ClosestParentDepth ?? this.GlobalSettings.ClosestParentDepth, cfg?.FarthestParentDepth ?? this.GlobalSettings.FarthestParentDepth) ?? string.Empty;
default:
default:
if (tag.StartsWith("parent")) {
var m = RangeRegex.Match(tag.Substring("parent".Length));
if (m.Success) {
Expand Down Expand Up @@ -596,6 +597,12 @@ internal string GetNewTitle(Solution solution, string pattern, SettingsSet cfg)
var index = Math.Min(documentPathParts.Length - 1, Math.Max(0, int.Parse(m.Groups["index"].Value, CultureInfo.InvariantCulture)));
return documentPathParts[documentPathParts.Length - 1 - index];
}
}
{
var m = EnvRegex.Match(tag);
if (m.Success) {
return Environment.GetEnvironmentVariable(m.Groups[1].Value);
}
}
break;
}
Expand All @@ -616,6 +623,7 @@ internal string GetNewTitle(Solution solution, string pattern, SettingsSet cfg)
return pattern + " " + appendedString;
}

static readonly Regex EnvRegex = new Regex(@"^env:(.+)$", RegexOptions.Compiled);
static readonly Regex IndexRegex = new Regex(@"^:?(?<index>[0-9]+)$", RegexOptions.Compiled);
static readonly Regex RangeRegex = new Regex(@"^:(?<startIndex>[0-9]+):(?<endIndex>[0-9]+)$", RegexOptions.Compiled);

Expand Down
9 changes: 9 additions & 0 deletions RenameVSWindowTitle/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions RenameVSWindowTitle/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@
<data name="tag_documentProjectName" xml:space="preserve">
<value>Active document project name (if the document is part of a loaded project)</value>
</data>
<data name="tag_envX" xml:space="preserve">
<value>Environment variable X for current Visual Studio process.</value>
</data>
<data name="tag_gitBranchName" xml:space="preserve">
<value>Current Git branch name. Make sure Git's executable directory is added to the Windows PATH variable or specify its location in settings.</value>
</data>
Expand Down
2 changes: 1 addition & 1 deletion RenameVSWindowTitle/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Identifier Id="5126c493-138a-46d7-a04d-ad772f6be159">
<Name>Rename Visual Studio Window Title</Name>
<Author>Erwin Mayer</Author>
<Version>3.3.5</Version>
<Version>3.3.6</Version>
<Description xml:space="preserve">This lightweight extension allows changing the window title of Visual Studio to include a folder tree with a configurable min depth and max depth distance from the solution/project file, and the use of special tags to help with many other possible scenarios (Git, TFS...).
Solution-specific overriding rules are available as well to cover virtually any possible renaming needs. It can also be configured so that the rules apply only when at least two instances of Visual Studio are running with the same window title.
This is particularly useful when branching a solution/project: it becomes possible to easily identify which branch you are working on, in case both would have the same solution/project name.</Description>
Expand Down

0 comments on commit 684ad23

Please sign in to comment.