Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Rollup #238

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
ebf502a
decaffeinate
aminya Apr 12, 2020
4a73c94
use babel to support import/export
aminya Apr 12, 2020
93200fe
tile: remove implicit returns
aminya Apr 12, 2020
a002793
cursor-position-view remove guard for getActiveTextEditor
aminya Apr 12, 2020
05aca2a
cursor-position-view Avoid inline assignments
aminya Apr 12, 2020
37cdefd
cursor-position-view remove implicit returns
aminya Apr 12, 2020
8063600
file-info-view: remove guard
aminya Apr 12, 2020
6be016b
file-info-view inline assignment
aminya Apr 12, 2020
c542b3b
file-info-view remove implicit returns
aminya Apr 12, 2020
1cb10e0
file-info-view suggestion
aminya Apr 12, 2020
fb8f2a1
launch-mode-view remove implicit returns
aminya Apr 12, 2020
8b39a24
selection-count-view remove guard
aminya Apr 12, 2020
bc1d09e
selection-count-view inline assignments
aminya Apr 12, 2020
9ed2f4d
selection-count-view remove implicit returns
aminya Apr 12, 2020
8a8233d
status-bar-view remove guard
aminya Apr 12, 2020
eefc443
status-bar-view remove IIFES (excess return)
aminya Apr 12, 2020
75af948
status-bar-view remove implicit returns
aminya Apr 12, 2020
940fe81
git-view remove gurad
aminya Apr 12, 2020
004d098
git-view inline-assignments
aminya Apr 12, 2020
2bae59b
git view remove implicit returns -
aminya Apr 12, 2020
f1a7317
git view return void instead of the functions
aminya Apr 12, 2020
6c1088b
git-view remove IIFEs (excess returns)
aminya Apr 12, 2020
5ccc119
main remove excess returns
aminya Apr 12, 2020
4e9313a
cursor-position-view shorter null check
aminya Apr 12, 2020
a56d047
file-info-view shorter null check
aminya Apr 12, 2020
5312a4f
git-view shorter null check
aminya Apr 12, 2020
5393fb1
launch-mode-view shorter null check
aminya Apr 12, 2020
b6e1621
main shorter null check
aminya Apr 12, 2020
b4896c4
selection-count-view shorter null check
aminya Apr 12, 2020
e5615e5
status-bar-view shorter null check
aminya Apr 12, 2020
10fabca
prettier
aminya Apr 12, 2020
ea79271
use babel to support optional chaining
aminya Jul 17, 2020
1efc353
bump dependencies
aminya Jul 4, 2020
7a6aeb4
remove not anymore needed "use-babel"
aminya Jul 4, 2020
3a89509
main remove unnecessary use of Array.from
aminya Jul 4, 2020
9455586
main named export activate, ...
aminya Jul 4, 2020
8d35724
main export StatusBarView to test in spec
aminya Jul 4, 2020
3887c4b
export classes directly
aminya Jul 4, 2020
31fb0db
git-view remove unused GitRepositoryAsync
aminya Jul 4, 2020
70a38d7
cursor-position-view optioal chaining
aminya Jul 5, 2020
9288dac
file-info-view optional chaining
aminya Jul 5, 2020
09e7cef
git view optional chaining
aminya Jul 5, 2020
a7148e0
launch-mode-view optional chaining
aminya Jul 5, 2020
0260546
main optional chaining
aminya Jul 5, 2020
ce42cfc
status-bar-view optional chaining
aminya Jul 5, 2020
7778aff
selection-count-view optional chaining
aminya Jul 5, 2020
402a8c4
Update package-lock.json
aminya Jul 17, 2020
648ddcc
rollup dependencies and scripts
aminya Jul 17, 2020
15ace90
add rollup config
aminya Jul 17, 2020
0491064
Update package-lock.json
aminya Jul 17, 2020
befef0b
update babel-preset atomic
aminya Aug 29, 2020
e66f894
update rollup-plugin-atomic
aminya Aug 29, 2020
5c87cf2
Update package-lock.json
aminya Aug 29, 2020
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
dist
10 changes: 10 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
let presets = ["babel-preset-atomic"];

let plugins = [];

module.exports = {
presets: presets,
plugins: plugins,
exclude: "node_modules/**",
sourceMap: "inline",
};
63 changes: 0 additions & 63 deletions lib/cursor-position-view.coffee

This file was deleted.

97 changes: 97 additions & 0 deletions lib/cursor-position-view.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import { Disposable } from 'atom';

export default class CursorPositionView {
constructor() {
this.viewUpdatePending = false;

this.element = document.createElement('status-bar-cursor');
this.element.classList.add('cursor-position', 'inline-block');
this.goToLineLink = document.createElement('a');
this.goToLineLink.classList.add('inline-block');
this.element.appendChild(this.goToLineLink);

let cursorPositionFormat = atom.config.get(
'status-bar.cursorPositionFormat'
);
this.formatString = cursorPositionFormat ? cursorPositionFormat : '%L:%C';

this.activeItemSubscription = atom.workspace.onDidChangeActiveTextEditor(
activeEditor => this.subscribeToActiveTextEditor()
);

this.subscribeToConfig();
this.subscribeToActiveTextEditor();

this.tooltip = atom.tooltips.add(this.element, {
title: () => `Line ${this.row}, Column ${this.column}`
});

this.handleClick();
}

destroy() {
this.activeItemSubscription.dispose();
this.cursorSubscription?.dispose();
this.tooltip.dispose();
this.configSubscription?.dispose();
this.clickSubscription.dispose();
this.updateSubscription?.dispose();
}

subscribeToActiveTextEditor() {
this.cursorSubscription?.dispose();

const selectionsMarkerLayer = atom.workspace.getActiveTextEditor()?.selectionsMarkerLayer;
this.cursorSubscription = selectionsMarkerLayer?.onDidUpdate(this.scheduleUpdate.bind(this));
this.scheduleUpdate();
}

subscribeToConfig() {
this.configSubscription?.dispose();
this.configSubscription = atom.config.observe(
'status-bar.cursorPositionFormat',
value => {
this.formatString = value ? value : '%L:%C';
this.scheduleUpdate();
}
);
}

handleClick() {
const clickHandler = () =>
atom.commands.dispatch(
atom.views.getView(atom.workspace.getActiveTextEditor()),
'go-to-line:toggle'
);
this.element.addEventListener('click', clickHandler);
this.clickSubscription = new Disposable(() =>
this.element.removeEventListener('click', clickHandler)
);
}

scheduleUpdate() {
if (this.viewUpdatePending) {
return;
}

this.viewUpdatePending = true;
this.updateSubscription = atom.views.updateDocument(() => {
this.viewUpdatePending = false;

const editor = atom.workspace.getActiveTextEditor();
let position = editor?.getCursorBufferPosition();

if (position) {
this.row = position.row + 1;
this.column = position.column + 1;
this.goToLineLink.textContent = this.formatString
.replace('%L', this.row)
.replace('%C', this.column);
this.element.classList.remove('hide');
} else {
this.goToLineLink.textContent = '';
this.element.classList.add('hide');
}
});
}
};
118 changes: 0 additions & 118 deletions lib/file-info-view.coffee

This file was deleted.

Loading