Skip to content

Commit 4b234fe

Browse files
committed
add DiffEngine.MaxInstances
1 parent 2d02206 commit 4b234fe

14 files changed

+128
-26
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!--
2+
GENERATED FILE - DO NOT EDIT
3+
This file was generated by [MarkdownSnippets](https://github.com/SimonCropp/MarkdownSnippets).
4+
Source File: /docs/mdsource/code-verus-machine-settings.source.md
5+
To change this file edit the source file and then run MarkdownSnippets.
6+
-->
7+
8+
# Code versus machine level settings
9+
10+
The approach to when a config setting is either a code based API or a machine level environment variable is driven by if the setting is a personal preference or shared.
11+
12+
13+
## Personal preferences
14+
15+
Settings that are personal preferences ideally should
16+
17+
* Not be share with other people using the same code base.
18+
* When running on the same machine, operate the same for different code bases that all use DiffEngine.
19+
* Not apply to CI.
20+
21+
Examples:
22+
23+
* [Custom order](diff-tool.order.md#custom-order) which depend on the tools a specific person has installed.
24+
* [Disable launching](/#disable-for-a-machineprocess).
25+
* [Max instances to launch](diff-tool.md#maxinstancestolaunch).
26+
27+
28+
## Shared preferences
29+
30+
Settings that are shared ideally should
31+
32+
* Checked into the code base.
33+
* Be share with other people using the same code base.
34+
* When running on the same machine, not effect different code bases that all use DiffEngine.
35+
* Apply to CI.
36+
37+
Examples:
38+
39+
* [File type detection](/#file-type-detection).
40+
* [Adding a share custom tool](/diff-tool.custom.md). A team may be comparing custom file types, and require a shared custom tool to verify that file.

docs/diff-tool.custom.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var resolvedTool = DiffTools.AddTool(
2323
exePath: diffToolPath,
2424
binaryExtensions: new[] {"jpg"})!;
2525
```
26-
<sup><a href='/src/Tests/DiffToolsTest.cs#L24-L35' title='File snippet `addtool` was extracted from'>snippet source</a> | <a href='#snippet-addtool' title='Navigate to start of snippet `addtool`'>anchor</a></sup>
26+
<sup><a href='/src/Tests/DiffToolsTest.cs#L23-L34' title='File snippet `addtool` was extracted from'>snippet source</a> | <a href='#snippet-addtool' title='Navigate to start of snippet `addtool`'>anchor</a></sup>
2727
<!-- endsnippet -->
2828

2929
Add a tool based on existing resolved tool:
@@ -36,7 +36,7 @@ var resolvedTool = DiffTools.AddToolBasedOn(
3636
name: "MyCustomDiffTool",
3737
arguments: (temp, target) => $"\"custom args {temp}\" \"{target}\"");
3838
```
39-
<sup><a href='/src/Tests/DiffToolsTest.cs#L65-L70' title='File snippet `addtoolbasedon` was extracted from'>snippet source</a> | <a href='#snippet-addtoolbasedon' title='Navigate to start of snippet `addtoolbasedon`'>anchor</a></sup>
39+
<sup><a href='/src/Tests/DiffToolsTest.cs#L64-L69' title='File snippet `addtoolbasedon` was extracted from'>snippet source</a> | <a href='#snippet-addtoolbasedon' title='Navigate to start of snippet `addtoolbasedon`'>anchor</a></sup>
4040
<!-- endsnippet -->
4141

4242

@@ -49,7 +49,7 @@ New tools are added to the top of the order, the last tool added will resolve be
4949
```cs
5050
DiffRunner.Launch(tempFile, targetFile);
5151
```
52-
<sup><a href='/src/Tests/DiffRunnerTests.cs#L21-L23' title='File snippet `diffrunnerlaunch` was extracted from'>snippet source</a> | <a href='#snippet-diffrunnerlaunch' title='Navigate to start of snippet `diffrunnerlaunch`'>anchor</a></sup>
52+
<sup><a href='/src/Tests/DiffRunnerTests.cs#L20-L22' title='File snippet `diffrunnerlaunch` was extracted from'>snippet source</a> | <a href='#snippet-diffrunnerlaunch' title='Navigate to start of snippet `diffrunnerlaunch`'>anchor</a></sup>
5353
<!-- endsnippet -->
5454

5555
Alternatively the instance returned from `AddTool*` can be used to explicitly launch that tool.
@@ -64,7 +64,7 @@ var resolvedTool = DiffTools.AddToolBasedOn(
6464

6565
DiffRunner.Launch(resolvedTool!, "PathToTempFile", "PathToTargetFile");
6666
```
67-
<sup><a href='/src/Tests/DiffToolsTest.cs#L79-L86' title='File snippet `addtoolandlaunch` was extracted from'>snippet source</a> | <a href='#snippet-addtoolandlaunch' title='Navigate to start of snippet `addtoolandlaunch`'>anchor</a></sup>
67+
<sup><a href='/src/Tests/DiffToolsTest.cs#L78-L85' title='File snippet `addtoolandlaunch` was extracted from'>snippet source</a> | <a href='#snippet-addtoolandlaunch' title='Navigate to start of snippet `addtoolandlaunch`'>anchor</a></sup>
6868
<!-- endsnippet -->
6969

7070

docs/diff-tool.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,20 @@ By default a maximum of 5 tool instances will be launched. This prevents a chang
4848

4949
This value can be changed:
5050

51+
52+
### Using an environment variable
53+
54+
Setting the `DiffEngine.MaxInstances` environment variable to the number of instances to launch.
55+
56+
57+
### Using code
58+
5159
<!-- snippet: MaxInstancesToLaunch -->
5260
<a id='snippet-maxinstancestolaunch'/></a>
5361
```cs
5462
DiffRunner.MaxInstancesToLaunch(10);
5563
```
56-
<sup><a href='/src/Tests/DiffToolsTest.cs#L13-L17' title='File snippet `maxinstancestolaunch` was extracted from'>snippet source</a> | <a href='#snippet-maxinstancestolaunch' title='Navigate to start of snippet `maxinstancestolaunch`'>anchor</a></sup>
64+
<sup><a href='/src/Tests/DiffToolsTest.cs#L12-L16' title='File snippet `maxinstancestolaunch` was extracted from'>snippet source</a> | <a href='#snippet-maxinstancestolaunch' title='Navigate to start of snippet `maxinstancestolaunch`'>anchor</a></sup>
5765
<!-- endsnippet -->
5866

5967

docs/diff-tool.order.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@ For example `VisualStudio,Meld` will result in VisualStudio then Meld then all o
5151
```cs
5252
DiffTools.UseOrder(DiffTool.VisualStudio, DiffTool.AraxisMerge);
5353
```
54-
<sup><a href='/src/Tests/DiffToolsTest.cs#L116-L118' title='File snippet `useorder` was extracted from'>snippet source</a> | <a href='#snippet-useorder' title='Navigate to start of snippet `useorder`'>anchor</a></sup>
54+
<sup><a href='/src/Tests/DiffToolsTest.cs#L115-L117' title='File snippet `useorder` was extracted from'>snippet source</a> | <a href='#snippet-useorder' title='Navigate to start of snippet `useorder`'>anchor</a></sup>
5555
<!-- endsnippet -->
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Code versus machine level settings
2+
3+
The approach to when a config setting is either a code based API or a machine level environment variable is driven by if the setting is a personal preference or shared.
4+
5+
6+
## Personal preferences
7+
8+
Settings that are personal preferences ideally should
9+
10+
* Not be share with other people using the same code base.
11+
* When running on the same machine, operate the same for different code bases that all use DiffEngine.
12+
* Not apply to CI.
13+
14+
Examples:
15+
16+
* [Custom order](diff-tool.order.md#custom-order) which depend on the tools a specific person has installed.
17+
* [Disable launching](/#disable-for-a-machineprocess).
18+
* [Max instances to launch](diff-tool.md#maxinstancestolaunch).
19+
20+
21+
## Shared preferences
22+
23+
Settings that are shared ideally should
24+
25+
* Checked into the code base.
26+
* Be share with other people using the same code base.
27+
* When running on the same machine, not effect different code bases that all use DiffEngine.
28+
* Apply to CI.
29+
30+
Examples:
31+
32+
* [File type detection](/#file-type-detection).
33+
* [Adding a share custom tool](/diff-tool.custom.md). A team may be comparing custom file types, and require a shared custom tool to verify that file.

docs/mdsource/diff-tool.source.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ By default a maximum of 5 tool instances will be launched. This prevents a chang
4141

4242
This value can be changed:
4343

44+
45+
### Using an environment variable
46+
47+
Setting the `DiffEngine.MaxInstances` environment variable to the number of instances to launch.
48+
49+
50+
### Using code
51+
4452
snippet: MaxInstancesToLaunch
4553

4654

docs/mdsource/doc-index.include.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
* [Tools](/docs/diff-tool.md)
22
* [Tool Order](/docs/diff-tool.order.md)
3-
* [Custom Tool](/docs/diff-tool.custom.md)
3+
* [Custom Tool](/docs/diff-tool.custom.md)
4+
* [Code versus machine level settings](/docs/code-verus-machine-settings.md)

docs/readme.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ To change this file edit the source file and then run MarkdownSnippets.
99

1010
* [Tools](/docs/diff-tool.md) <!-- include: doc-index. path: /docs/mdsource/doc-index.include.md -->
1111
* [Tool Order](/docs/diff-tool.order.md)
12-
* [Custom Tool](/docs/diff-tool.custom.md) <!-- end include: doc-index. path: /docs/mdsource/doc-index.include.md -->
12+
* [Custom Tool](/docs/diff-tool.custom.md)
13+
* [Code versus machine level settings](/docs/code-verus-machine-settings.md) <!-- end include: doc-index. path: /docs/mdsource/doc-index.include.md -->

readme.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ Support is available via [Tidelift](https://tidelift.com/subscription/pkg/nuget-
3333
* [Security contact information](#security-contact-information)<!-- endtoc -->
3434
* [Tools](/docs/diff-tool.md) <!-- include: doc-index. path: /docs/mdsource/doc-index.include.md -->
3535
* [Tool Order](/docs/diff-tool.order.md)
36-
* [Custom Tool](/docs/diff-tool.custom.md) <!-- end include: doc-index. path: /docs/mdsource/doc-index.include.md -->
36+
* [Custom Tool](/docs/diff-tool.custom.md)
37+
* [Code versus machine level settings](/docs/code-verus-machine-settings.md) <!-- end include: doc-index. path: /docs/mdsource/doc-index.include.md -->
3738

3839

3940
## NuGet package
@@ -76,7 +77,7 @@ A tool can be launched using the following:
7677
```cs
7778
DiffRunner.Launch(tempFile, targetFile);
7879
```
79-
<sup><a href='/src/Tests/DiffRunnerTests.cs#L21-L23' title='File snippet `diffrunnerlaunch` was extracted from'>snippet source</a> | <a href='#snippet-diffrunnerlaunch' title='Navigate to start of snippet `diffrunnerlaunch`'>anchor</a></sup>
80+
<sup><a href='/src/Tests/DiffRunnerTests.cs#L20-L22' title='File snippet `diffrunnerlaunch` was extracted from'>snippet source</a> | <a href='#snippet-diffrunnerlaunch' title='Navigate to start of snippet `diffrunnerlaunch`'>anchor</a></sup>
8081
<!-- endsnippet -->
8182

8283
Note that this method will respect the above [difference behavior](/docs/diff-tool.md#detected-difference-behavior) in terms of Auto refresh and MDI behaviors.
@@ -91,15 +92,15 @@ A tool can be closed using the following:
9192
```cs
9293
DiffRunner.Kill(tempFile, targetFile);
9394
```
94-
<sup><a href='/src/Tests/DiffRunnerTests.cs#L31-L33' title='File snippet `diffrunnerkill` was extracted from'>snippet source</a> | <a href='#snippet-diffrunnerkill' title='Navigate to start of snippet `diffrunnerkill`'>anchor</a></sup>
95+
<sup><a href='/src/Tests/DiffRunnerTests.cs#L30-L32' title='File snippet `diffrunnerkill` was extracted from'>snippet source</a> | <a href='#snippet-diffrunnerkill' title='Navigate to start of snippet `diffrunnerkill`'>anchor</a></sup>
9596
<!-- endsnippet -->
9697

9798
Note that this method will respect the above [difference behavior](/docs/diff-tool.md#detected-difference-behavior) in terms of MDI behavior.
9899

99100

100101
## File type detection
101102

102-
DiffEngine use [EmptyFiles](https://github.com/SimonCropp/EmptyFiles) to determine if a given file or extension is a binary or text.
103+
DiffEngine use [EmptyFiles](https://github.com/SimonCropp/EmptyFiles) to determine if a given file or extension is a binary or text. Custom extensions can be added, or existing ones changed.
103104

104105

105106
## BuildServerDetector

readme.source.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Note that this method will respect the above [difference behavior](/docs/diff-to
4747

4848
## File type detection
4949

50-
DiffEngine use [EmptyFiles](https://github.com/SimonCropp/EmptyFiles) to determine if a given file or extension is a binary or text.
50+
DiffEngine use [EmptyFiles](https://github.com/SimonCropp/EmptyFiles) to determine if a given file or extension is a binary or text. Custom extensions can be added, or existing ones changed.
5151

5252

5353
## BuildServerDetector

0 commit comments

Comments
 (0)