-
Notifications
You must be signed in to change notification settings - Fork 29.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #162320: Add a button and a hover when a long line is truncated
- Loading branch information
Showing
6 changed files
with
82 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/vs/editor/contrib/longLinesHelper/browser/longLinesHelper.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { Disposable } from 'vs/base/common/lifecycle'; | ||
import { ICodeEditor, MouseTargetType } from 'vs/editor/browser/editorBrowser'; | ||
import { registerEditorContribution } from 'vs/editor/browser/editorExtensions'; | ||
import { EditorOption } from 'vs/editor/common/config/editorOptions'; | ||
import { IEditorContribution } from 'vs/editor/common/editorCommon'; | ||
|
||
class LongLinesHelper extends Disposable implements IEditorContribution { | ||
public static readonly ID = 'editor.contrib.longLinesHelper'; | ||
|
||
public static get(editor: ICodeEditor): LongLinesHelper | null { | ||
return editor.getContribution<LongLinesHelper>(LongLinesHelper.ID); | ||
} | ||
|
||
constructor( | ||
private readonly _editor: ICodeEditor, | ||
) { | ||
super(); | ||
|
||
this._register(this._editor.onMouseDown((e) => { | ||
const stopRenderingLineAfter = this._editor.getOption(EditorOption.stopRenderingLineAfter); | ||
if (stopRenderingLineAfter >= 0 && e.target.type === MouseTargetType.CONTENT_TEXT && e.target.position.column >= stopRenderingLineAfter) { | ||
this._editor.updateOptions({ | ||
stopRenderingLineAfter: -1 | ||
}); | ||
} | ||
})); | ||
} | ||
} | ||
|
||
registerEditorContribution(LongLinesHelper.ID, LongLinesHelper); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters