├── Resources
├── Space.svg
├── Screenshots
│ ├── Selection.png
│ ├── Showcase.png
│ └── Underline.png
├── Styles
│ ├── Theme.less
│ └── Package.less
├── Keymap.json
└── Menus.json
├── Documentation
├── Contribute.md
├── KeyBindings.md
├── Customize.md
└── Changelog.md
├── .editorconfig
├── Tests
├── Workspace
│ └── Example.coffee
└── highlight-line-spec.js
├── Source
├── Settings.js
├── Commands.js
├── Actions.js
├── App.js
├── Marker.js
├── Select.js
└── Model.js
├── LICENSE
├── .github
├── ISSUE_TEMPLATE
│ └── BUG-Report.yml
└── workflows
│ └── ci.yml
├── package.json
└── README.md
/Resources/Space.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Resources/Screenshots/Selection.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Pulsar-Edit-Highlights/line/HEAD/Resources/Screenshots/Selection.png
--------------------------------------------------------------------------------
/Resources/Screenshots/Showcase.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Pulsar-Edit-Highlights/line/HEAD/Resources/Screenshots/Showcase.png
--------------------------------------------------------------------------------
/Resources/Screenshots/Underline.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Pulsar-Edit-Highlights/line/HEAD/Resources/Screenshots/Underline.png
--------------------------------------------------------------------------------
/Resources/Styles/Theme.less:
--------------------------------------------------------------------------------
1 |
2 | @cursorBackground : rgba( 100 , 100 , 100 , 0.3 ) ;
3 |
4 | @lineColour : rgb(202, 141, 29) ;
5 |
--------------------------------------------------------------------------------
/Documentation/Contribute.md:
--------------------------------------------------------------------------------
1 |
2 | # Contributing
3 |
4 | Before you open a pull request, make sure to have all tests pass.
5 |
6 |
7 |
8 | ## Running Tests
9 |
10 | Tests can be run with:
11 |
12 | ```sh
13 | npm run test
14 | ```
15 |
16 |
17 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 |
2 | root = true
3 |
4 | [*]
5 |
6 | end_of_line = lf
7 |
8 | [*.{gitignore,json,less,yml,js,md}]
9 |
10 | trim_trailing_whitespace = true
11 | insert_final_newline = true
12 | indent_style = space
13 | indent_size = 4
14 | charset = utf-8
15 |
16 | [*.md]
17 |
18 | trim_trailing_whitespace = false
--------------------------------------------------------------------------------
/Resources/Keymap.json:
--------------------------------------------------------------------------------
1 | {
2 | "atom-text-editor" : {
3 | "cmd-alt-shift-h" : "highlight-line:toggle-hide-highlight-on-select" ,
4 | "cmd-alt-shift-u" : "highlight-line:toggle-selection-borders" ,
5 | "cmd-shift-h" : "highlight-line:toggle-background" ,
6 | "cmd-shift-u" : "highlight-line:toggle-underline"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Tests/Workspace/Example.coffee:
--------------------------------------------------------------------------------
1 | # Sample file for ensuring the regions get added.
2 | # Output Fizz on multiples of 3, Output Buzz on multiples of 5
3 | # Output FizzBuzz on multiples of 3 and 5
4 |
5 | output = ""
6 |
7 | i = 1
8 | while i <= 100
9 | string = "#{i} "
10 | string += 'Fizz' if i % 3 is 0
11 | string += 'Buzz' if i % 5 is 0
12 | output += "#{string}\n"
13 | i++
14 |
--------------------------------------------------------------------------------
/Source/Settings.js:
--------------------------------------------------------------------------------
1 |
2 | const { config } = atom;
3 |
4 |
5 | const Settings = {
6 | hideWhenSelecting : 'hideHighlightOnSelect' ,
7 | paintBackground : 'enableBackgroundColor' ,
8 | paintUnderline : 'enableUnderline' ,
9 | underlineStyle : 'underline' ,
10 | paintOverline : 'enableSelectionBorder'
11 | }
12 |
13 |
14 | const { defineProperty , entries } = Object;
15 |
16 |
17 | for ( const [ name , setting ] of entries(Settings)){
18 |
19 | const get = () => config
20 | .get(`highlight-line.${ setting }`);
21 |
22 | defineProperty(exports,name,{ get })
23 | }
24 |
--------------------------------------------------------------------------------
/Source/Commands.js:
--------------------------------------------------------------------------------
1 |
2 | const Actions = require('./Actions');
3 |
4 | const { commands , config } = atom;
5 |
6 |
7 |
8 | function toggle ( setting ){
9 |
10 | const opposite = !
11 | config.get(setting);
12 |
13 | config.set(setting,opposite);
14 | }
15 |
16 |
17 | const registerAction = ([ action , setting ]) =>
18 | commands.add('atom-workspace',{
19 | [ action ] : () => toggle(setting)
20 | });
21 |
22 |
23 | function * register (){
24 |
25 | for ( const action of Actions )
26 | yield registerAction(action)
27 | }
28 |
29 |
30 |
31 | module.exports = { register }
32 |
--------------------------------------------------------------------------------
/Source/Actions.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | const Id = 'highlight-line';
4 |
5 |
6 | const Actions = {
7 | 'toggle-hide-highlight-on-select' : 'hideHighlightOnSelect' ,
8 | 'toggle-selection-borders' : 'enableSelectionBorder' ,
9 | 'toggle-background' : 'enableBackgroundColor' ,
10 | 'toggle-underline' : 'enableUnderline'
11 | }
12 |
13 |
14 | const toCommand = ( name ) =>
15 | `${ Id }:${ name }`
16 |
17 | const toSetting = ( name ) =>
18 | `${ Id }.${ name }`
19 |
20 |
21 | const toAction = ([ command , setting ]) =>
22 | [ toCommand(command) , toSetting(setting) ]
23 |
24 |
25 | module.exports = Object
26 | .entries(Actions)
27 | .map(toAction)
28 |
--------------------------------------------------------------------------------
/Source/App.js:
--------------------------------------------------------------------------------
1 |
2 | const
3 | { CompositeDisposable } = require('atom') ,
4 | HighlightLineModel = require('./Model') ,
5 | Commands = require('./Commands') ;
6 |
7 |
8 |
9 | module.exports = {
10 |
11 | subscriptions : null ,
12 | line : null ,
13 |
14 |
15 | activate (){
16 |
17 | this.subscriptions = new CompositeDisposable;
18 | this.line = new HighlightLineModel;
19 |
20 | this.subscriptions.add(
21 | ... Commands.register() );
22 | },
23 |
24 |
25 | deactivate (){
26 |
27 | const { subscriptions , line } = this;
28 |
29 | line.destroy();
30 |
31 | subscriptions.dispose();
32 | this.subscriptions = null;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Source/Marker.js:
--------------------------------------------------------------------------------
1 |
2 | const Settings = require('./Settings');
3 |
4 | const { workspace } = atom;
5 |
6 |
7 |
8 | function marker ( range , styling ){
9 |
10 | let selector = 'highlight-line';
11 |
12 | if( styling )
13 | selector += styling;
14 |
15 |
16 | const editor = workspace
17 | .getActiveTextEditor();
18 |
19 | const marker = editor
20 | .markBufferRange(range);
21 |
22 | editor.decorateMarker(marker,{
23 | class : selector ,
24 | type : 'line'
25 | })
26 |
27 | return marker
28 | }
29 |
30 |
31 | function line ( range , type ){
32 |
33 | const { underlineStyle } = Settings;
34 |
35 | return marker(range,`-multi-line-${ underlineStyle }-${ type }`);
36 | }
37 |
38 |
39 | module.exports = { marker , line }
40 |
--------------------------------------------------------------------------------
/Resources/Menus.json:
--------------------------------------------------------------------------------
1 | {
2 | "menu" : [{
3 |
4 | "label" : "Packages" ,
5 |
6 | "submenu" : [{
7 |
8 | "label" : "Highlight Line" ,
9 |
10 | "submenu" : [{
11 | "command" : "highlight-line:toggle-background" ,
12 | "label" : "Toggle Background"
13 | },{
14 | "command" : "highlight-line:toggle-hide-highlight-on-select" ,
15 | "label" : "Toggle Hide Highlight on Select"
16 | },{
17 | "command" : "highlight-line:toggle-underline" ,
18 | "label" : "Toggle Underline"
19 | },{
20 | "command" : "highlight-line:toggle-selection-borders" ,
21 | "label" : "Toggle Selection Borders"
22 | }]
23 | }]
24 | }]
25 | }
26 |
--------------------------------------------------------------------------------
/Documentation/KeyBindings.md:
--------------------------------------------------------------------------------
1 |
2 | # Keybindings
3 |
4 | *Toggles whether or not the ..*
5 |
6 |
7 |
8 | ## Highlighting
9 |
10 | Cmd **+** Alt **+** H
11 |
12 |
13 |
14 | background of the current
15 | line should be highlighted.
16 |
17 |
18 |
19 | ## On Selection
20 |
21 | Cmd **+** Alt **+** Shift **+** H
22 |
23 |
24 |
25 | background of the current line should be
26 | highlighted while selecting some text.
27 |
28 |
29 |
30 | ## Underline
31 |
32 | Cmd **+** Alt **+** U
33 |
34 |
35 |
36 | current line should be underlined.
37 |
38 |
39 |
40 | ## Borders
41 |
42 | Cmd **+** Alt **+** Shift **+** U
43 |
44 |
45 |
46 | area of the currently selection text should
47 | be have borders at the top and bottom.
48 |
49 |
50 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2014 Richard Race
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Documentation/Customize.md:
--------------------------------------------------------------------------------
1 |
2 | # Customization
3 |
4 | Colors can be set by modifying the [`Theme.less`]
5 | stylesheet or by adding to your `style.less` file.
6 |
7 |
8 |
9 | *Using the `.cursor-line` class selector is not recommended as
10 | you will loose highlighting when selecting text on the current line.*
11 |
12 |
13 |
14 | ```scss
15 | atom-text-editor::shadow {
16 |
17 | /*
18 | * Background
19 | * Uses !important to override theme specific settings
20 | */
21 |
22 | .line.highlight-line {
23 | background : rgba( 255 , 0 , 0 , 0.3 ) !important ;
24 | }
25 |
26 | /*
27 | * Underline
28 | * Replace `solid` with `dashed` or `dotted` depending
29 | * on the style you selected in the settings.
30 | */
31 |
32 | .line.highlight-line-multi-line-solid-bottom {
33 | border-bottom-color : red ;
34 | }
35 |
36 | /*
37 | * Borders
38 | * Style for the optional area selection borders.
39 | */
40 |
41 | .line.highlight-line-multi-line-solid-top {
42 | border-top-color : red ;
43 | }
44 | }
45 | ```
46 |
47 |
48 |
49 | [`Theme.less`]: ../Resources/Styles/Theme.less
50 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/BUG-Report.yml:
--------------------------------------------------------------------------------
1 |
2 | description : Create a new ticket for a bug.
3 | title : ❌ Title
4 | name : Bug Report
5 |
6 | labels:
7 |
8 | - bug
9 |
10 | body:
11 |
12 | # Pulsar Version
13 |
14 | - type : textarea
15 | id : pulsar-version
16 |
17 | attributes:
18 |
19 | description : Version of Pulsar, check with `pulsar --version`
20 | label : Pulsar Version
21 | value : |
22 | Pulsar : 1.100.0-beta
23 | Electron : 12.2.3
24 | Chrome : 89.0.4389.128
25 | Node : 14.16.0
26 |
27 | validations:
28 |
29 | required : true
30 |
31 |
32 | # Package Version
33 |
34 | - type : input
35 | id : package-version
36 |
37 | attributes:
38 |
39 | description : Version of Highlight-Line.
40 | placeholder : 0.12.0
41 | label : Package Version
42 |
43 | validations:
44 |
45 | required : true
46 |
47 |
48 | # Description
49 |
50 | - type : textarea
51 | id : description
52 |
53 | attributes:
54 |
55 | description : Please describe your problem as detailed as possible.
56 | label : Description
57 |
--------------------------------------------------------------------------------
/Resources/Styles/Package.less:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * The UI variables found in this file are defined in the themes
4 | * you are using, for example check the atom-dark-ui theme:
5 | *
6 | * https://github.com/pulsar-edit/atom-dark-ui/blob/master/styles/ui-variables.less
7 | *
8 | */
9 |
10 |
11 | @import "Theme";
12 |
13 | @borderWidth : +1px;
14 | @marginWidth : -1px;
15 |
16 |
17 | .highlight-view.hidden {
18 | display : none ;
19 | }
20 |
21 |
22 | .highlight-multi-line ( @style : '' ){
23 |
24 | .line[ class *= 'highlight-line-multi-line-@{style}-top' ]{
25 | border-top-width : @borderWidth ;
26 | border-top-color : @lineColour ;
27 | border-top-style : @style ;
28 | margin-top : @marginWidth ;
29 | }
30 |
31 | .line[ class *= 'highlight-line-multi-line-@{style}-bottom' ]{
32 | border-bottom-width : @borderWidth ;
33 | border-bottom-color : @lineColour ;
34 | border-bottom-style : @style ;
35 | margin-bottom : @marginWidth ;
36 | }
37 | }
38 |
39 |
40 | atom-text-editor {
41 |
42 | .line.highlight-line {
43 | background : @cursorBackground !important ;
44 | }
45 |
46 | .highlight-multi-line(dashed) ;
47 | .highlight-multi-line(dotted) ;
48 | .highlight-multi-line(solid) ;
49 | }
50 |
--------------------------------------------------------------------------------
/Source/Select.js:
--------------------------------------------------------------------------------
1 |
2 | const { marker , line } = require('./Marker');
3 | const Settings = require('./Settings');
4 |
5 | const { workspace } = atom;
6 |
7 |
8 | const toContent = ( selection ) => [
9 | selection.isSingleScreenLine() ,
10 | selection.getBufferRange() ,
11 | selection.getText()
12 | ]
13 |
14 | const selections = () => workspace
15 | .getActiveTextEditor()
16 | .getSelections()
17 | .map(toContent);
18 |
19 |
20 | module.exports = function * (){
21 |
22 | const { hideWhenSelecting , paintUnderline ,
23 | paintBackground , paintOverline } = Settings;
24 |
25 |
26 | for ( const [ single , range , text ] of selections() ){
27 |
28 | if( single ){
29 |
30 | if( paintUnderline)
31 | yield line(range,'bottom');
32 |
33 | if( ! paintBackground )
34 | continue
35 |
36 | if( text.length && hideWhenSelecting )
37 | continue
38 |
39 | yield marker(range);
40 |
41 | continue
42 | }
43 |
44 | if( ! paintOverline )
45 | continue
46 |
47 | const [ bottom , top ] =
48 | [ range.copy() , range.copy() ];
49 |
50 | bottom.start = bottom.end;
51 | top.end = top.start;
52 |
53 | if(bottom.start.column === 0)
54 | bottom.start.row -= 1;
55 |
56 | yield line(bottom,'bottom');
57 | yield line(top,'top');
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Highlights the current line in your editor",
3 | "repository": "https://github.com/Pulsar-Edit-Highlights/line",
4 | "homepage": "https://github.com/Pulsar-Edit-Highlights/line",
5 | "version": "1.0.1",
6 | "license": "MIT",
7 | "name": "line",
8 | "keywords": [
9 | "highlight",
10 | "line",
11 | "selectiton"
12 | ],
13 | "bugs": {
14 | "url": "https://github.com/Pulsar-Edit-Highlights/line/issues"
15 | },
16 | "keymaps": [
17 | "../Resources/Keymap.json"
18 | ],
19 | "menus": [
20 | "../Resources/Menus.json"
21 | ],
22 | "main": "./Source/App",
23 | "styleSheets": [
24 | "../Resources/Styles/Package.less",
25 | "../Resources/Styles/Theme.less"
26 | ],
27 | "scripts": {
28 | "test": "pulsar --test Tests"
29 | },
30 | "engines": {
31 | "pulsar": ">=1.100.0 <2.0.0"
32 | },
33 | "configSchema": {
34 | "enableBackgroundColor": {
35 | "default": true,
36 | "type": "boolean"
37 | },
38 | "hideHighlightOnSelect": {
39 | "default": false,
40 | "type": "boolean"
41 | },
42 | "enableSelectionBorder": {
43 | "default": false,
44 | "type": "boolean"
45 | },
46 | "enableUnderline": {
47 | "default": false,
48 | "type": "boolean"
49 | },
50 | "underline": {
51 | "default": "solid",
52 | "enum": [
53 | "solid",
54 | "dotted",
55 | "dashed"
56 | ],
57 | "type": "string"
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 |
2 | name: CI
3 |
4 | # Disabled as long as the GitHub Action
5 | # is not available / ppm is not properly
6 | # installed.
7 | #
8 | on:
9 | workflow_dispatch:
10 |
11 | # pull_request:
12 |
13 | # push:
14 | # branches:
15 |
16 | # - main
17 |
18 | jobs:
19 |
20 | Test:
21 |
22 | runs-on : ${{ matrix.os }}
23 | if : "!contains(github.event.head_commit.message,'[skip ci]')"
24 |
25 | strategy:
26 | matrix:
27 | channel : [ stable , beta ]
28 | os : [ ubuntu-latest , macos-latest , windows-latest ]
29 |
30 | steps:
31 |
32 | - uses : actions/checkout@v3
33 |
34 | # - uses : pulsar-edit/action-setup-pulsar
35 | # with :
36 | # channel : ${{ matrix.channel }}
37 |
38 | - name : Print Pulsar's Version
39 | run : pulsar -v
40 |
41 | - name : Print PPM's Version
42 | run : ppm -v
43 |
44 | - name : Install Dependencies
45 | run : ppm ci
46 | env :
47 | APM_TEST_PACKAGES : minimap minimap-highlight-selected status-bar
48 |
49 | - name : Run Tests
50 | run : npm run test
51 |
52 |
53 | Skip:
54 |
55 | runs-on : ubuntu-latest
56 | if : "contains(github.event.head_commit.message,'[skip ci]')"
57 |
58 | steps:
59 |
60 | - name : Skip CI 🚫
61 | run : echo skip ci
62 |
--------------------------------------------------------------------------------
/Source/Model.js:
--------------------------------------------------------------------------------
1 |
2 | const { CompositeDisposable } = require('atom');
3 | const { workspace , config } = atom;
4 | const select = require('./Select');
5 |
6 | const activeEditor = () =>
7 | workspace.getActiveTextEditor();
8 |
9 |
10 | module.exports = class HighlightLineView {
11 |
12 | subscriptions = new CompositeDisposable;
13 | markers = [];
14 |
15 |
16 | constructor (){
17 |
18 | const update = () =>
19 | this.updateSelectedLine();
20 |
21 |
22 | const { subscriptions } = this;
23 |
24 | subscriptions.add(
25 | workspace.observeTextEditors((editor) => {
26 | editor.onDidChangeSelectionRange(update);
27 | editor.onDidRemoveSelection(update);
28 | editor.onDidAddSelection(update);
29 | }));
30 |
31 | subscriptions.add(
32 | workspace.onDidChangeActivePaneItem(update));
33 |
34 |
35 | this.observeSettings();
36 | this.updateSelectedLine();
37 | }
38 |
39 |
40 | // Tear down any state and detach
41 |
42 | destroy (){
43 | this.subscriptions.dispose();
44 | }
45 |
46 |
47 | updateSelectedLine (){
48 | this.resetBackground();
49 | this.showHighlight();
50 | }
51 |
52 |
53 | resetBackground (){
54 |
55 | for ( const marker of this.markers )
56 | marker.destroy();
57 |
58 | this.markers = [];
59 | }
60 |
61 | showHighlight (){
62 |
63 | if( ! activeEditor() )
64 | return;
65 |
66 | this.markers.push( ... select() );
67 | }
68 |
69 |
70 | observeSettings (){
71 |
72 | const { subscriptions } = this;
73 |
74 | const settings = [
75 | 'highlight-line.enableBackgroundColor' ,
76 | 'highlight-line.hideHighlightOnSelect' ,
77 | 'highlight-line.enableSelectionBorder' ,
78 | 'highlight-line.enableUnderline'
79 | ]
80 |
81 | for ( const setting of settings ){
82 |
83 | const listener = config
84 | .onDidChange(setting,() => this.updateSelectedLine());
85 |
86 | subscriptions.add(listener);
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |