Skip to content
Closed
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
80 changes: 80 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
// JS Files
"root": true,
"env": {
"atomtest": true,
"es6": true,
"node": true,
"browser": true,
"jasmine": true
},
"globals": { "atom": "writable" },
"parser": "babel-eslint",
"parserOptions": {
"ecmaFeatures": { "jsx": true },
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": ["only-warn"],
"extends": ["eslint:recommended"],
"overrides": [
{ // Bundled node version with atom has an old ESLint
// TypeScript files
"files": ["**/*.ts", "**/*.tsx"],
"env": {
"atomtest": true,
"es6": true,
"node": true,
"browser": true
},
"globals": { "atom": "writable" },
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": { "jsx": true },
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "only-warn"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/member-delimiter-style": "off"
}
},
{
// CoffeeScript files
"files": ["**/*.coffee"],
"env": {
"atomtest": true,
"es6": true,
"node": true,
"browser": true
},
"globals": { "atom": "writable" },
// "parser": "eslint-plugin-coffee",
"parser": "eslint-plugin-coffee",
"parserOptions": {
"ecmaFeatures": { "jsx": true },
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": ["coffee", "only-warn"],
"extends": ["plugin:coffee/eslint-recommended"]
},
{
// JSON files
"files": ["*.json"],
"plugins": ["json"],
"extends": ["plugin:json/recommended"],
"rules": {
"json/*": ["error", {"allowComments": true}]
}
}
]
}
64 changes: 64 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI
on:
- push
- pull_request

jobs:
Test:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
name: Julia ${{ matrix.julia_version }} - ${{ matrix.os }} - ${{ matrix.arch }} - Atom ${{ matrix.atom_channel }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
atom_channel: [stable] # beta
julia_version: ["1", "nightly"]
arch: ["x64"]
steps:
- uses: actions/checkout@v2
- uses: UziTech/action-setup-atom@v1
with:
channel: ${{ matrix.atom_channel }}
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia_version }}
arch: ${{ matrix.arch }}
- name: Versions
run: |
julia -v
apm -v
- name: Install APM dependencies
run: |
apm ci # uses locked module. use `apm install` for non-locked
apm install ink language-julia
node script/postinstall.js
- name: Julia CI
run: julia -e 'include("ci/packages.jl")'
shell: bash
# - name: Run tests 👩🏾‍💻
# run: atom --test spec

Lint:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "13.x"
- name: Install NPM dependencies
run: |
npm ci # uses locked module. use `npm install` for non-locked
- name: Lint ✨
run: npm run lint

Skip:
if: contains(github.event.head_commit.message, '[skip ci]')
runs-on: ubuntu-latest
steps:
- name: Skip CI 🚫
run: echo skip ci
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
.DS_Store
npm-debug.log
node_modules
lib_src/**/*
!lib_src/tsconfig.json
!lib_src/tslint.json
tsconfig.tsbuildinfo

!lib_src/misc/colors.ts
52 changes: 0 additions & 52 deletions .travis.yml

This file was deleted.

24 changes: 0 additions & 24 deletions appveyor.yml

This file was deleted.

5 changes: 5 additions & 0 deletions lib/misc/colors.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export declare function getColors(selectors: {
[P: string]: string;
}): {
[P: string]: string;
};
51 changes: 27 additions & 24 deletions lib/misc/colors.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,47 @@
'use babel'

export function getColors(selectors) {
let grammar = atom.grammars.grammarForScopeName("source.julia")

let styled = {}
let color = {}
let div = document.createElement('div')
div.classList.add('editor', 'editor-colors', 'julia-syntax-color-selector')

for (let style in selectors) {
let child = document.createElement('span')
child.innerText = 'foo'
"use strict"
Object.defineProperty(exports, "__esModule", { value: true })
function getColors(selectors) {
// const grammar = atom.grammars.grammarForScopeName("source.julia") // TODO ?
const styled = {}
const color = {}
const div = document.createElement("div")
div.classList.add("editor", "editor-colors", "julia-syntax-color-selector")
for (const style in selectors) {
const child = document.createElement("span")
child.innerText = "foo"
child.classList.add(...selectors[style])
div.appendChild(child)
styled[style] = child
}

document.body.appendChild(div)
// wait till rendered?
for (let style in selectors) {
for (const style in selectors) {
// TODO do we need try catch
try {
color[style] = rgb2hex(window.getComputedStyle(styled[style])['color'])
color[style] = rgb2hex(window.getComputedStyle(styled[style]).color)
} catch (e) {
console.error(e)
}
}
color['background'] = rgb2hex(window.getComputedStyle(div)['backgroundColor'])
color.background = rgb2hex(window.getComputedStyle(div).backgroundColor)
document.body.removeChild(div)

return color
}

exports.getColors = getColors
function rgb2hex(rgb) {
if (rgb.search("rgb") == -1) {
if (rgb.search("rgb") === -1) {
return rgb
} else {
rgb = rgb.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+))?\)$/)
function hex(x) {
return ("0" + parseInt(x).toString(16)).slice(-2);
const rgb_match = rgb.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+))?\)$/)
if (rgb_match) {
return hex(rgb_match[1]) + hex(rgb_match[2]) + hex(rgb_match[3])
} else {
// TODO should we check for this error?
console.error(rgb.concat(" isn't a rgb string!"))
return "#000000" // black
}
return hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
}
}
function hex(x) {
return ("0" + parseInt(x, 10).toString(16)).slice(-2)
}
52 changes: 52 additions & 0 deletions lib_src/misc/colors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
export function getColors(selectors: { [P: string]: string }) {
// const grammar = atom.grammars.grammarForScopeName("source.julia") // TODO ?

const styled: { [P: string]: HTMLSpanElement } = {}
const color: { [P: string]: string } = {}

const div = document.createElement("div")
div.classList.add("editor", "editor-colors", "julia-syntax-color-selector")

for (const style in selectors) {
const child = document.createElement("span")
child.innerText = "foo"
child.classList.add(...selectors[style])
div.appendChild(child)
styled[style] = child
}

document.body.appendChild(div)
// wait till rendered?
for (const style in selectors) {
// TODO do we need try catch
try {
color[style] = rgb2hex(window.getComputedStyle(styled[style]).color)
} catch (e) {
console.error(e)
}
}
color.background = rgb2hex(window.getComputedStyle(div).backgroundColor)
document.body.removeChild(div)

return color
}

function rgb2hex(rgb: string): string {
if (rgb.search("rgb") === -1) {
return rgb
} else {
const rgb_match = rgb.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+))?\)$/)

if (rgb_match) {
return hex(rgb_match[1]) + hex(rgb_match[2]) + hex(rgb_match[3])
} else {
// TODO should we check for this error?
console.error(rgb.concat(" isn't a rgb string!"))
return "#000000" // black
}
}
}

function hex(x: string) {
return ("0" + parseInt(x, 10).toString(16)).slice(-2)
}
Loading