Repository: obsidian-tasks-group/obsidian-tasks (ts)

Issue:
Add instruction to reverse "short mode"
### ⚠️ Please check that this feature request hasn't been suggested before.

- [X] I searched previous [Ideas in Discussions](https://github.com/obsidian-tasks-group/obsidian-tasks/discussions/categories/ideas-any-new-feature-requests-go-in-issues-please?discussions_q=category%3A%22Ideas%3A+Any+New+Feature+Requests+go+in+Issues+please%22+-label%3A%22status%3A+released%22+-label%3Aduplicate+sort%3Atop) didn't find any similar feature requests.
- [X] I searched previous [Issues](https://github.com/obsidian-tasks-group/obsidian-tasks/issues?q=is%3Aopen+is%3Aissue+label%3A%22type%3A+enhancement%22+sort%3Acomments-desc) didn't find any similar feature requests.

### 🔖 Feature description

Currently, once `short mode` has been used in a query block, there is no later way to reverse this.

Once we have some kind of global filter in settings - see #1619 - it would be good to provide a way to revert it in later queries.

This plus #1619 will also be an alternative implement to the declined request in #1791.

### ✔️ Solution

Ideas for the instruction's name:

- #1791's author suggested `short mode off`
- Another option, which I slightly prefer, is `full mode`

Other ideas are welcome.


### ❓ Alternatives

_No response_

### 📝 Additional Context

_No response_

Pull request description:
feat: Add 'full mode' instruction, to negate 'short mode'
<!--- Provide a general summary of your changes in the Title above -->

# Description

This adds the 'full mode' instruction, to negate 'short mode'.

It's useful if you wish to set all queries to `short mode` by default in your global query, and then turn off `short mode` in a few specific queries, by adding `full mode`.

## Motivation and Context

Fixes #1806.

## How has this been tested?

- Adding new tests (including testing parsing of `short mode`)
- Manual exploratory testing.

## Screenshots (if appropriate)

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->

Changes visible to users:

- [x] **New feature** (prefix: `feat` - non-breaking change which adds functionality)
- [x] **Documentation** (prefix: `docs` - improvements to any documentation content **for users**)

Internal changes:

- [x] **Tests** (prefix: `test` - additions and improvements to unit tests and the smoke tests)

## Checklist

<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->

- [x] My code follows the code style of this project and passes `yarn run lint`.
- [x] My change requires a change to the documentation.
- [x] I have [updated the documentation](https://publish.obsidian.md/tasks-contributing/Documentation/About+Documentation) accordingly.
- [x] My change has adequate [Unit Test coverage](https://publish.obsidian.md/tasks-contributing/Testing/About+Testing).

## Terms

<!--
By submitting this pull request, you must agree to follow our
[contributing guide](https://publish.obsidian.md/tasks-contributing) and
[Code of Conduct](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/CODE_OF_CONDUCT.md).
Put an x in the boxes to confirm you agree.
-->

- [x] My contribution follow this project's [contributing guide](https://publish.obsidian.md/tasks-contributing)
- [x] I agree to follow this project's [Code of Conduct](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/CODE_OF_CONDUCT.md)


Patch:
diff --git a/docs/Introduction.md b/docs/Introduction.md
index 19fe58c9..40525154 100644
--- a/docs/Introduction.md
+++ b/docs/Introduction.md
@@ -13,15 +13,16 @@ _In recent [releases](https://github.com/obsidian-tasks-group/obsidian-tasks/rel
     Move the older ones down to the top of the comment block below...
 -->
 
+- X.Y.Z: 🔥 Add [[Layout#Full Mode|'full mode']] to turn off `short mode`.
 - 5.3.0: 🔥 Add [[Postponing|postpone button]] to Tasks query results.
 - 5.3.0: 🔥 Add [[Toggling and Editing Statuses#'Change task status' context menu|'change task status' menu]] to Reading mode and Tasks query results.
 - 5.3.0: 🔥 Add documentation section about [[About Editing|editing tasks]].
 - 5.3.0: 🔥 Add documentation page about [[toggling and editing statuses]].
+
+<!--
 - 5.2.0: 🔥 Most query instructions can now include [[About Queries#Capitals in Query Instructions - Case Insensitivity|capital letters]].
 - 5.1.0: 🔥 Add 'Review and check your Statuses' facility: see [[Check your Statuses|check your statuses]].
 - 5.1.0: 🔥 Enable [[Custom Filters|custom filters]] and [[Custom Grouping|custom grouping]] to use [[Query Properties|query properties]] directly - no placeholders required.
-
-<!--
 - 5.0.0: 🔥 Add [[Line Continuations|line continuations]].
   - **Warning**: This is a [[Line Continuations#Appendix Updating pre-5.0.0 searches with trailing backslashes|potentially breaking change]] if you search for backslash (`\`) characters.
 - 5.0.0: 🔥 Document [[Comments#Inline comments|inline comments]]
diff --git a/docs/Queries/Global Query.md b/docs/Queries/Global Query.md
index 3c0945d3..40b06847 100644
--- a/docs/Queries/Global Query.md
+++ b/docs/Queries/Global Query.md
@@ -48,7 +48,7 @@ The `ignore global query` instruction was added in Tasks 4.6.0.
 Currently, any query that is allowed in a task block will also work as your Global Query. This feature is especially useful for applying [filters](Filters) or [layout options](Layout) by default for all your queries.
 
 > [!warning]
-> It isn't always possible to override a filter or layout option set in the Global Query. We're tracking this across several issues: [issue #1619](https://github.com/obsidian-tasks-group/obsidian-tasks/issues/1619) and [issue #1806](https://github.com/obsidian-tasks-group/obsidian-tasks/issues/1806).
+> It isn't always possible to override a filter set in the Global Query. We're tracking this in [issue #1619](https://github.com/obsidian-tasks-group/obsidian-tasks/issues/1619).
 
 ### [[Layout]]
 
diff --git a/docs/Queries/Layout.md b/docs/Queries/Layout.md
index e3fcf620..b6da99f9 100644
--- a/docs/Queries/Layout.md
+++ b/docs/Queries/Layout.md
@@ -57,6 +57,23 @@ Example:
     show urgency
     ```
 
+## Full Mode
+
+In full mode, query results will show the emojis and the concrete recurrence rule or dates.
+
+This is the default mode.
+
+The command is `full mode`.
+
+Example:
+
+    ```tasks
+    not done
+    full mode
+    ```
+
+This can be reversed with [[#Short Mode]].
+
 ## Short Mode
 
 In short mode, query results will only show the emojis, but not the concrete recurrence rule or dates.
@@ -70,3 +87,5 @@ Example:
     not done
     short mode
     ```
+
+This can be reversed with [[#Full Mode]].
diff --git a/docs/Quick Reference.md b/docs/Quick Reference.md
index cd219013..bf308c58 100644
--- a/docs/Quick Reference.md
+++ b/docs/Quick Reference.md
@@ -58,9 +58,10 @@ This table summarizes the filters and other options available inside a `tasks` b
 | `limit groups to <number> tasks`<br>`limit groups <number>`                                                                                                                                                                                                                                                                                           |                                             |                        |                        |                                                                                                                                |
 | **Other Layout Options**                                                                                                                                                                                                                                                                                                                              |                                             |                        |                        |                                                                                                                                |
 | `hide edit button`                                                                                                                                                                                                                                                                                                                                    |                                             |                        |                        |                                                                                                                                |
-| `hide postpone button`                                                                                                                                                                                                                                                                                                                                    |                                             |                        |                        |                                                                                                                                |
+| `hide postpone button`                                                                                                                                                                                                                                                                                                                                |                                             |                        |                        |                                                                                                                                |
 | `hide task count`                                                                                                                                                                                                                                                                                                                                     |                                             |                        |                        |                                                                                                                                |
 | `short mode`                                                                                                                                                                                                                                                                                                                                          |                                             |                        |                        |                                                                                                                                |
+| `full mode`                                                                                                                                                                                                                                                                                                                                           |                                             |                        |                        |                                                                                                                                |
 | **Other Instructions**                                                                                                                                                                                                                                                                                                                                |                                             |                        |                        |                                                                                                                                |
 | `ignore global query`                                                                                                                                                                                                                                                                                                                                 |                                             |                        |                        |                                                                                                                                |
 | `explain`                                                                                                                                                                                                                                                                                                                                             |                                             |                        |                        |                                                                                                                                |
diff --git a/src/Query/Query.ts b/src/Query/Query.ts
index c98c536d..99848c79 100644
--- a/src/Query/Query.ts
+++ b/src/Query/Query.ts
@@ -35,6 +35,7 @@ export class Query implements IQuery {
     private readonly hideOptionsRegexp =
         /^(hide|show) (task count|backlink|priority|created date|start date|scheduled date|done date|due date|recurrence rule|edit button|postpone button|urgency|tags)/i;
     private readonly shortModeRegexp = /^short/i;
+    private readonly fullModeRegexp = /^full/i;
     private readonly explainQueryRegexp = /^explain/i;
     private readonly ignoreGlobalQueryRegexp = /^ignore global query/i;
 
@@ -65,6 +66,9 @@ export class Query implements IQuery {
                 case this.shortModeRegexp.test(line):
                     this._queryLayoutOptions.shortMode = true;
                     break;
+                case this.fullModeRegexp.test(line):
+                    this._queryLayoutOptions.shortMode = false;
+                    break;
                 case this.explainQueryRegexp.test(line):
                     this._queryLayoutOptions.explainQuery = true;
                     break;


Test patch:
diff --git a/tests/Query.test.ts b/tests/Query.test.ts
index a70f8d77..87e89145 100644
--- a/tests/Query.test.ts
+++ b/tests/Query.test.ts
@@ -395,6 +395,8 @@ describe('Query parsing', () => {
         const filters: ReadonlyArray<string> = [
             '# Comment lines are ignored',
             'explain',
+            'full',
+            'full mode',
             'hide backlink',
             'hide created date',
             'hide done date',
@@ -480,6 +482,16 @@ describe('Query parsing', () => {
         expect(new Query('GROUP BY STATUS.TYPE').grouping[0].property).toEqual('status.type');
     });
 
+    it('should parse "short mode" and "full mode" correctly', () => {
+        // Check 'short' mode is enabled:
+        expect(new Query('short').queryLayoutOptions.shortMode).toEqual(true);
+        expect(new Query('short mode').queryLayoutOptions.shortMode).toEqual(true);
+
+        // Check that 'full' reverses short mode:
+        expect(new Query('short\nfull mode').queryLayoutOptions.shortMode).toEqual(false);
+        expect(new Query('short mode\nfull').queryLayoutOptions.shortMode).toEqual(false);
+    });
+
     describe('should include instruction in parsing error messages', () => {
         function getQueryError(source: string) {
             return new Query(source).error;