Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Collapsed Text #170447

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
0086d4b
support showing collapsed text at the end of the first line of the fo…
mtbaqer Nov 23, 2022
e5aa75d
Merge branch 'microsoft:main' into collapsed-text
mtbaqer Nov 23, 2022
9357128
support startColumn in FoldingRange
mtbaqer Dec 19, 2022
44a9949
Merge branch 'main' into collapsed-text
mtbaqer Dec 19, 2022
461a54d
clean up
mtbaqer Dec 19, 2022
7b15ee6
pass missing foldingOffset arguments in couple places
mtbaqer Dec 19, 2022
098c709
unfold hidden ranges if selection is within the column range
mtbaqer Dec 20, 2022
783c1ed
support clicking collapsedText to unfold ranges with a set startColumn
mtbaqer Dec 20, 2022
373aaa2
hide decorations after the folding offset.
mtbaqer Dec 21, 2022
3a3fe9d
fix startColumn comparison in FoldingRegions.sanitizeAndMerge
mtbaqer Dec 21, 2022
78c3e7f
update foldingModel tests to include startColumn cases
mtbaqer Dec 21, 2022
d591451
update sanitizeAndMerge validation to include cases where ranges star…
mtbaqer Dec 21, 2022
c2dbf98
fix sanitizeAndMerge not throwing out ranges starting at line 0 as a …
mtbaqer Dec 21, 2022
a5706ed
update foldingRanges tests to include startColumn cases
mtbaqer Dec 21, 2022
001846b
test foldingDecorations
mtbaqer Dec 22, 2022
e353b18
support having an empty collapsedText
mtbaqer Dec 23, 2022
8bec5d8
update modelLineProjection tests to include inline fold cases
mtbaqer Dec 23, 2022
e98387c
move collapsedText and startColumn properties to vscode.proposed.coll…
mtbaqer Jan 2, 2023
b9b4ece
Merge branch 'main' into collapsed-text
mtbaqer Jan 2, 2023
b642001
make sanitizeAndMerge consider ranges duplicate if one has startColum…
mtbaqer Jan 2, 2023
84ba9e5
clean up
mtbaqer Jan 2, 2023
6e15aa2
Merge branch 'main' into collapsed-text
mtbaqer Jan 3, 2023
5ed4abc
enforce enabledApiProposals checking for collapsedText
mtbaqer Jan 5, 2023
4159152
Merge branch 'main' into collapsed-text
mtbaqer Jan 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
move collapsedText and startColumn properties to vscode.proposed.coll…
…apsedText
mtbaqer committed Jan 2, 2023
commit e98387cf44d3ec94435bd1b845ab33ca21ac0cfb
1 change: 1 addition & 0 deletions src/vs/workbench/api/common/extHost.api.impl.ts
Original file line number Diff line number Diff line change
@@ -1273,6 +1273,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
FileType: files.FileType,
FilePermission: files.FilePermission,
FoldingRange: extHostTypes.FoldingRange,
FoldingRange2: extHostTypes.FoldingRange,
FoldingRangeKind: extHostTypes.FoldingRangeKind,
FunctionBreakpoint: extHostTypes.FunctionBreakpoint,
InlineCompletionItem: extHostTypes.InlineSuggestion,
2 changes: 1 addition & 1 deletion src/vs/workbench/api/common/extHostTypeConverters.ts
Original file line number Diff line number Diff line change
@@ -1375,7 +1375,7 @@ export namespace ProgressLocation {
}

export namespace FoldingRange {
export function from(r: vscode.FoldingRange): languages.FoldingRange {
export function from(r: vscode.FoldingRange2): languages.FoldingRange {
const range: languages.FoldingRange = {
start: r.start + 1,
end: r.end + 1,
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
export const allApiProposals = Object.freeze({
authSession: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authSession.d.ts',
codiconDecoration: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.codiconDecoration.d.ts',
collapsedText: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.collapsedText.d.ts',
commentsResolvedState: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentsResolvedState.d.ts',
contribCommentPeekContext: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentPeekContext.d.ts',
contribCommentThreadAdditionalMenu: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentThreadAdditionalMenu.d.ts',
12 changes: 1 addition & 11 deletions src/vscode-dts/vscode.d.ts
Original file line number Diff line number Diff line change
@@ -5175,11 +5175,6 @@ declare module 'vscode' {
*/
start: number;

/**
* The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line.
*/
startColumn?: number;

/**
* The zero-based end line of the range to fold. The folded area ends with the line's last character.
* To be valid, the end must be zero or larger and smaller than the number of lines in the document.
@@ -5195,19 +5190,14 @@ declare module 'vscode' {
*/
kind?: FoldingRangeKind;

/**
* The text to be shown instead of the folded area.
*/
collapsedText?: string;

/**
* Creates a new folding range.
*
* @param start The start line of the folded range.
* @param end The end line of the folded range.
* @param kind The kind of the folding range.
*/
constructor(start: number, end: number, kind?: FoldingRangeKind, collapsedText?: string);
constructor(start: number, end: number, kind?: FoldingRangeKind);
}

/**
55 changes: 55 additions & 0 deletions src/vscode-dts/vscode.proposed.collapsedText.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

declare module 'vscode' {

/**
* A line based folding range. To be valid, start and end line must be bigger than zero and smaller than the number of lines in the document.
* Invalid ranges will be ignored.
*/
export class FoldingRange2 {

/**
* The zero-based start line of the range to fold.
* The folded area starts at the start column if set, otherwise, after the line's last character.
* To be valid, the end must be zero or larger and smaller than the number of lines in the document.
*/
start: number;

/**
* The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line.
*/
startColumn?: number;

/**
* The zero-based end line of the range to fold. The folded area ends with the line's last character.
* To be valid, the end must be zero or larger and smaller than the number of lines in the document.
*/
end: number;

/**
* Describes the {@link FoldingRangeKind Kind} of the folding range such as {@link FoldingRangeKind.Comment Comment} or
* {@link FoldingRangeKind.Region Region}. The kind is used to categorize folding ranges and used by commands
* like 'Fold all comments'. See
* {@link FoldingRangeKind} for an enumeration of all kinds.
* If not set, the range is originated from a syntax element.
*/
kind?: FoldingRangeKind;

/**
* The text to be shown instead of the folded area.
*/
collapsedText?: string;

/**
* Creates a new folding range.
*
* @param start The start line of the folded range.
* @param end The end line of the folded range.
* @param kind The kind of the folding range.
*/
constructor(start: number, end: number, kind?: FoldingRangeKind, collapsedText?: string, startColumn?: number);
}
}