Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 17 additions & 6 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,29 @@ jobs:
Lint:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2
- name: Commit lint ✨
uses: wagoid/commitlint-github-action@v2

- uses: UziTech/action-setup-atom@v1
- name: Setup PNPM
uses: pnpm/action-setup@v1.2.1
with:
node-version: "12.x"
- name: Install NPM dependencies
run: |
npm install --ignore-scripts
version: latest

- name: Install dependencies
run: pnpm install

- name: Format ✨
run: pnpm test.format

- name: Lint ✨
run: npm run test:lint
run: pnpm test.lint

Release:
needs: [Test, Lint]
Expand Down
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
public-hoist-pattern[]=*
package-lock=false
lockfile=true
10 changes: 10 additions & 0 deletions lib/deps/underscore-plus.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,13 @@ export function dasherize(string) {
}
})
}

export function debounce(callback, wait) {
let timeoutId = null
return (...args) => {
clearTimeout(timeoutId)
timeoutId = setTimeout(() => {
callback.apply(null, args)
}, wait)
}
}
22 changes: 16 additions & 6 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import config from "./config.json"
import * as PluginManagement from "./plugin-management"
import { treeSitterWarning } from "./performance-monitor"
import DOMStylesReader from "./dom-styles-reader"
import { debounce } from "./deps/underscore-plus"

export { default as config } from "./config.json"
export * from "./plugin-management"
Expand Down Expand Up @@ -398,6 +399,7 @@ export function observeMinimaps(iterator) {
* @access private
*/
function initSubscriptions() {
const debounceUpdateStyles = debounce(updateStyles, 300)
subscriptions.add(
atom.workspace.observeTextEditors((textEditor) => {
const minimap = minimapForEditor(textEditor)
Expand All @@ -407,16 +409,24 @@ function initSubscriptions() {
minimapElement.attach(textEditor.getElement())
}),
// empty color cache if the theme changes
atom.themes.onDidChangeActiveThemes(() => {
domStylesReader.invalidateDOMStylesCache()
editorsMinimaps.forEach((minimap) => {
atom.views.getView(minimap).requestForcedUpdate()
})
}),
atom.themes.onDidChangeActiveThemes(debounceUpdateStyles),
atom.styles.onDidUpdateStyleElement(debounceUpdateStyles),
atom.styles.onDidAddStyleElement(debounceUpdateStyles),
atom.styles.onDidRemoveStyleElement(debounceUpdateStyles),
treeSitterWarning()
)
}

/**
* Force update styles of minimap
*/
function updateStyles() {
domStylesReader.invalidateDOMStylesCache()
editorsMinimaps.forEach((minimap) => {
atom.views.getView(minimap).requestForcedUpdate()
})
}

// The public exports included in the service:
const MinimapServiceV1 = {
minimapViewProvider,
Expand Down
Loading