Merge branch 'master' into remove-windows-build-tools

This commit is contained in:
Amin Yahyaabadi 2021-04-28 04:40:57 -05:00 committed by GitHub
commit 772a47964f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
258 changed files with 11725 additions and 5787 deletions

10
.gitattributes vendored
View File

@ -15,3 +15,13 @@ spec/fixtures/sample.txt text eol=lf
# Windows bash scripts are also Unix LF endings
*.sh eol=lf
# The script executables should be LF so they can be edited on Windows
script/bootstrap text eol=lf
script/build text eol=lf
script/cibuild text eol=lf
script/clean text eol=lf
script/lint text eol=lf
script/postprocess-junit-results text eol=lf
script/test text eol=lf
script/verify-snapshot-script text eol=lf

4
.gitignore vendored
View File

@ -9,13 +9,13 @@ Thumbs.db
.vscode
.python-version
node_modules
npm-debug.log
debug.log
*.log
/tags
/atom-shell/
/out/
docs/output
docs/includes
spec/fixtures/evil-files/
!spec/fixtures/packages/package-with-incompatible-native-module-loaded-conditionally/node_modules/
out/
/electron/

View File

@ -2,7 +2,7 @@
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards

View File

@ -82,7 +82,7 @@ Here's a list of the big ones:
* [language-javascript](https://github.com/atom/language-javascript) - all bundled languages are packages too, and each one has a separate package `language-[name]`. Use these for feedback on syntax highlighting issues that only appear for a specific language.
* [one-dark-ui](https://github.com/atom/one-dark-ui) - the default UI styling for anything but the text editor. UI theme packages (i.e. packages with a `-ui` suffix) provide only styling and it's possible that a bundled package is responsible for a UI issue. There are other bundled UI themes, such as [one-light-ui](https://github.com/atom/one-light-ui).
* [one-dark-syntax](https://github.com/atom/one-dark-syntax) - the default syntax highlighting styles applied for all languages. There are other bundled syntax themes, such as [solarized-dark-syntax](https://github.com/atom/solarized-dark-syntax). You should use these packages for reporting issues that appear in many languages, but disappear if you change to another syntax theme.
* [apm](https://github.com/atom/apm) - the `apm` command line tool (Atom Package Manager). You should use this repository for any contributions related to the `apm` tool and to publishing packages.
* [apm](https://github.com/atom/apm) - the `apm` command line tool (Atom Package Manager). You should use this repository for any contributions related to the `apm` tool and for publishing packages.
* [atom.io](https://github.com/atom/atom.io) - the repository for feedback on the [Atom.io website](https://atom.io) and the [Atom.io package API](https://github.com/atom/atom/blob/master/docs/apm-rest-api.md) used by [apm](https://github.com/atom/apm).
There are many more, but this list should be a good starting point. For more information on how to work with Atom's official packages, see [Contributing to Atom Packages][contributing-to-official-atom-packages].
@ -354,7 +354,7 @@ This section lists the labels we use to help us track and manage issues and pull
[GitHub search](https://help.github.com/articles/searching-issues/) makes it easy to use labels for finding groups of issues or pull requests you're interested in. For example, you might be interested in [open issues across `atom/atom` and all Atom-owned packages which are labeled as bugs, but still need to be reliably reproduced](https://github.com/search?utf8=%E2%9C%93&q=is%3Aopen+is%3Aissue+user%3Aatom+label%3Abug+label%3Aneeds-reproduction) or perhaps [open pull requests in `atom/atom` which haven't been reviewed yet](https://github.com/search?utf8=%E2%9C%93&q=is%3Aopen+is%3Apr+repo%3Aatom%2Fatom+comments%3A0). To help you find issues and pull requests, each label is listed with search links for finding open items with that label in `atom/atom` only and also across all Atom repositories. We encourage you to read about [other search filters](https://help.github.com/articles/searching-issues/) which will help you write more focused queries.
The labels are loosely grouped by their purpose, but it's not required that every issue have a label from every group or that an issue can't have more than one label from the same group.
The labels are loosely grouped by their purpose, but it's not required that every issue has a label from every group or that an issue can't have more than one label from the same group.
Please open an issue on `atom/atom` if you have suggestions for new labels, and if you notice some labels are missing on some repositories, then please open an issue on that repository.

View File

@ -1,20 +1,31 @@
# VERSION: 0.1
# DESCRIPTION: Image to build Atom and create a .rpm file
# VERSION: 0.2
# DESCRIPTION: Image to build Atom
# Base docker image
FROM nodesource/fedora21:4.2.6
FROM ubuntu:20.04
# Install dependencies
RUN yum install -y \
make \
gcc \
gcc-c++ \
glibc-devel \
git-core \
libsecret-devel \
rpmdevtools
RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" \
apt-get install -y \
build-essential \
git \
libsecret-1-dev \
fakeroot \
rpm \
libx11-dev \
libxkbfile-dev \
libgdk-pixbuf2.0-dev \
libgtk-3-dev \
libxss-dev \
libasound2-dev \
npm && \
rm -rf /var/lib/apt/lists/*
# Update npm and dependencies
RUN npm install -g npm --loglevel error
ADD . /atom
WORKDIR /atom
# Use python2 by default
RUN npm config set python /usr/bin/python2 -g
ENTRYPOINT ["/usr/bin/env", "sh", "-c"]
CMD ["bash"]

View File

@ -1,4 +1,4 @@
Copyright (c) 2011-2020 GitHub Inc.
Copyright (c) 2011-2021 GitHub Inc.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@ -76,9 +76,10 @@ repeat these steps to upgrade to future releases.
## Discussion
* Discuss Atom on our [forums](https://discuss.atom.io/)
* Discuss Atom on our [forums](https://discuss.atom.io/) or on [GitHub Discussions](https://github.com/atom/atom/discussions)
* Chat about Atom on our Slack team -- [instructions for joining](https://discuss.atom.io/t/join-us-on-slack/16638?source_topic_id=25406)
## License
[MIT](https://github.com/atom/atom/blob/master/LICENSE.md)

3742
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
{
"name": "atom",
"productName": "Atom",
"version": "1.53.0-dev",
"version": "1.58.0-dev",
"description": "A hackable text editor for the 21st Century.",
"main": "./src/main-process/main.js",
"repository": {
@ -12,11 +12,12 @@
"url": "https://github.com/atom/atom/issues"
},
"license": "MIT",
"electronVersion": "6.1.12",
"electronVersion": "9.4.4",
"dependencies": {
"@atom/nsfw": "1.0.26",
"@atom/fuzzy-native": "^1.2.0",
"@atom/nsfw": "^1.0.27",
"@atom/source-map-support": "^0.3.4",
"@atom/watcher": "1.3.4-0",
"@atom/watcher": "^1.3.5",
"about": "file:packages/about",
"archive-view": "https://www.atom.io/api/packages/archive-view/versions/0.65.2/tarball",
"async": "3.2.0",
@ -25,11 +26,11 @@
"atom-keymap": "8.2.14",
"atom-light-syntax": "file:packages/atom-light-syntax",
"atom-light-ui": "file:packages/atom-light-ui",
"atom-select-list": "^0.7.2",
"atom-select-list": "0.8.0",
"autocomplete-atom-api": "https://www.atom.io/api/packages/autocomplete-atom-api/versions/0.10.7/tarball",
"autocomplete-css": "https://www.atom.io/api/packages/autocomplete-css/versions/0.17.5/tarball",
"autocomplete-html": "https://www.atom.io/api/packages/autocomplete-html/versions/0.8.8/tarball",
"autocomplete-plus": "https://www.atom.io/api/packages/autocomplete-plus/versions/2.42.3/tarball",
"autocomplete-plus": "https://www.atom.io/api/packages/autocomplete-plus/versions/2.42.4/tarball",
"autocomplete-snippets": "https://www.atom.io/api/packages/autocomplete-snippets/versions/1.12.1/tarball",
"autoflow": "file:packages/autoflow",
"autosave": "https://www.atom.io/api/packages/autosave/versions/0.24.6/tarball",
@ -39,11 +40,11 @@
"base16-tomorrow-light-theme": "file:packages/base16-tomorrow-light-theme",
"bookmarks": "https://www.atom.io/api/packages/bookmarks/versions/0.46.0/tarball",
"bracket-matcher": "https://www.atom.io/api/packages/bracket-matcher/versions/0.91.2/tarball",
"chai": "4.2.0",
"chart.js": "^2.3.0",
"chai": "4.3.4",
"chart.js": "2.9.4",
"clear-cut": "^2.0.2",
"coffee-script": "1.12.7",
"color": "^0.7.3",
"color": "3.1.3",
"command-palette": "https://www.atom.io/api/packages/command-palette/versions/0.43.5/tarball",
"dalek": "file:packages/dalek",
"dedent": "^0.7.0",
@ -51,23 +52,23 @@
"dev-live-reload": "file:packages/dev-live-reload",
"devtron": "1.4.0",
"electron-notarize": "1.0.0",
"electron-osx-sign": "0.4.17",
"electron-osx-sign": "0.5.0",
"encoding-selector": "https://www.atom.io/api/packages/encoding-selector/versions/0.23.9/tarball",
"etch": "0.14.1",
"event-kit": "^2.5.3",
"exception-reporting": "file:packages/exception-reporting",
"find-and-replace": "https://www.atom.io/api/packages/find-and-replace/versions/0.219.5/tarball",
"find-and-replace": "https://www.atom.io/api/packages/find-and-replace/versions/0.219.7/tarball",
"find-parent-dir": "^0.3.0",
"first-mate": "7.4.1",
"focus-trap": "6.1.0",
"focus-trap": "6.3.0",
"fs-admin": "0.15.0",
"fs-plus": "^3.1.1",
"fstream": "1.0.12",
"fuzzaldrin": "^2.1",
"fuzzy-finder": "https://www.atom.io/api/packages/fuzzy-finder/versions/1.14.3/tarball",
"git-diff": "file:packages/git-diff",
"git-utils": "5.6.2",
"github": "https://www.atom.io/api/packages/github/versions/0.35.0/tarball",
"git-utils": "5.7.1",
"github": "https://www.atom.io/api/packages/github/versions/0.36.9/tarball",
"glob": "^7.1.1",
"go-to-line": "file:packages/go-to-line",
"grammar-selector": "file:packages/grammar-selector",
@ -89,7 +90,7 @@
"language-go": "https://www.atom.io/api/packages/language-go/versions/0.47.2/tarball",
"language-html": "https://www.atom.io/api/packages/language-html/versions/0.53.1/tarball",
"language-hyperlink": "https://www.atom.io/api/packages/language-hyperlink/versions/0.17.1/tarball",
"language-java": "https://www.atom.io/api/packages/language-java/versions/0.31.5/tarball",
"language-java": "https://www.atom.io/api/packages/language-java/versions/0.32.1/tarball",
"language-javascript": "https://www.atom.io/api/packages/language-javascript/versions/0.134.1/tarball",
"language-json": "https://www.atom.io/api/packages/language-json/versions/1.0.5/tarball",
"language-less": "https://www.atom.io/api/packages/language-less/versions/0.34.3/tarball",
@ -118,14 +119,14 @@
"line-top-index": "0.3.1",
"link": "file:packages/link",
"markdown-preview": "https://www.atom.io/api/packages/markdown-preview/versions/0.160.2/tarball",
"marked": "1.1.1",
"marked": "1.2.0",
"metrics": "https://www.atom.io/api/packages/metrics/versions/1.8.1/tarball",
"minimatch": "^3.0.3",
"mocha": "2.5.1",
"mocha": "6.2.3",
"mocha-junit-reporter": "2.0.0",
"mocha-multi-reporters": "^1.1.4",
"mock-spawn": "^0.2.6",
"normalize-package-data": "^2.0.0",
"normalize-package-data": "3.0.2",
"notifications": "https://www.atom.io/api/packages/notifications/versions/0.71.0/tarball",
"nslog": "^3.0.0",
"one-dark-syntax": "file:packages/one-dark-syntax",
@ -135,32 +136,33 @@
"open-on-github": "https://www.atom.io/api/packages/open-on-github/versions/1.3.2/tarball",
"package-generator": "https://www.atom.io/api/packages/package-generator/versions/1.3.0/tarball",
"pathwatcher": "8.1.0",
"postcss": "8.0.9",
"postcss-selector-parser": "2.2.1",
"prebuild-install": "5.3.5",
"postcss": "8.1.6",
"postcss-selector-parser": "6.0.4",
"prebuild-install": "6.0.0",
"property-accessors": "^1.1.3",
"resolve": "1.17.0",
"resolve": "1.18.1",
"scandal": "^3.2.0",
"scoped-property-store": "^0.17.0",
"scrollbar-style": "3.2.1",
"scrollbar-style": "^4.0.1",
"season": "^6.0.2",
"semver": "7.3.2",
"service-hub": "^0.7.4",
"settings-view": "https://www.atom.io/api/packages/settings-view/versions/0.261.5/tarball",
"sinon": "9.0.3",
"settings-view": "https://www.atom.io/api/packages/settings-view/versions/0.261.8/tarball",
"sinon": "9.2.1",
"snippets": "https://www.atom.io/api/packages/snippets/versions/1.5.1/tarball",
"solarized-dark-syntax": "file:packages/solarized-dark-syntax",
"solarized-light-syntax": "file:packages/solarized-light-syntax",
"spell-check": "https://www.atom.io/api/packages/spell-check/versions/0.76.1/tarball",
"spell-check": "https://www.atom.io/api/packages/spell-check/versions/0.77.1/tarball",
"status-bar": "https://www.atom.io/api/packages/status-bar/versions/1.8.17/tarball",
"styleguide": "https://www.atom.io/api/packages/styleguide/versions/0.49.12/tarball",
"superstring": "^2.4.4",
"symbols-view": "https://www.atom.io/api/packages/symbols-view/versions/0.118.4/tarball",
"tabs": "https://www.atom.io/api/packages/tabs/versions/0.110.0/tarball",
"temp": "^0.9.0",
"text-buffer": "13.17.3",
"temp": "0.9.2",
"text-buffer": "^13.18.5",
"timecop": "https://www.atom.io/api/packages/timecop/versions/0.36.2/tarball",
"tree-sitter": "0.17.0",
"tree-view": "https://www.atom.io/api/packages/tree-view/versions/0.228.1/tarball",
"tree-sitter": "0.17.1",
"tree-view": "https://www.atom.io/api/packages/tree-view/versions/0.228.3/tarball",
"typescript-simple": "8.0.6",
"update-package-dependencies": "file:./packages/update-package-dependencies",
"vscode-ripgrep": "1.9.0",
@ -168,7 +170,7 @@
"whitespace": "https://www.atom.io/api/packages/whitespace/versions/0.37.7/tarball",
"winreg": "^1.2.1",
"wrap-guide": "https://www.atom.io/api/packages/wrap-guide/versions/0.41.0/tarball",
"yargs": "^16.0.3"
"yargs": "16.1.0"
},
"packageDependencies": {
"atom-dark-syntax": "file:./packages/atom-dark-syntax",
@ -188,7 +190,7 @@
"autocomplete-atom-api": "0.10.7",
"autocomplete-css": "0.17.5",
"autocomplete-html": "0.8.8",
"autocomplete-plus": "2.42.3",
"autocomplete-plus": "2.42.4",
"autocomplete-snippets": "1.12.1",
"autoflow": "file:./packages/autoflow",
"autosave": "0.24.6",
@ -201,9 +203,9 @@
"dev-live-reload": "file:./packages/dev-live-reload",
"encoding-selector": "0.23.9",
"exception-reporting": "file:./packages/exception-reporting",
"find-and-replace": "0.219.5",
"find-and-replace": "0.219.7",
"fuzzy-finder": "1.14.3",
"github": "0.35.0",
"github": "0.36.9",
"git-diff": "file:./packages/git-diff",
"go-to-line": "file:./packages/go-to-line",
"grammar-selector": "file:./packages/grammar-selector",
@ -217,15 +219,15 @@
"notifications": "0.71.0",
"open-on-github": "1.3.2",
"package-generator": "1.3.0",
"settings-view": "0.261.5",
"settings-view": "0.261.8",
"snippets": "1.5.1",
"spell-check": "0.76.1",
"spell-check": "0.77.1",
"status-bar": "1.8.17",
"styleguide": "0.49.12",
"symbols-view": "0.118.4",
"tabs": "0.110.0",
"timecop": "0.36.2",
"tree-view": "0.228.1",
"tree-view": "0.228.3",
"update-package-dependencies": "file:./packages/update-package-dependencies",
"welcome": "file:./packages/welcome",
"whitespace": "0.37.7",
@ -240,7 +242,7 @@
"language-go": "0.47.2",
"language-html": "0.53.1",
"language-hyperlink": "0.17.1",
"language-java": "0.31.5",
"language-java": "0.32.1",
"language-javascript": "0.134.1",
"language-json": "1.0.5",
"language-less": "0.34.3",

View File

@ -1,6 +1,6 @@
const { Disposable } = require('atom');
const etch = require('etch');
const shell = require('shell');
const { shell } = require('electron');
const AtomLogo = require('./atom-logo');
const EtchComponent = require('../etch-component');
const UpdateView = require('./update-view');

View File

@ -4,4 +4,8 @@
@import "styles/syntax-variables.less";
@import "styles/editor.less";
@import "styles/syntax.less";
@import "styles/syntax-legacy/_base.less";
@import "styles/syntax/base.less";
@import "styles/syntax/css.less";
@import "styles/syntax/html.less";

View File

@ -0,0 +1,267 @@
/*
This defines styling rules for syntax classes.
See the naming conventions for a list of syntax classes:
https://flight-manual.atom.io/hacking-atom/sections/syntax-naming-conventions
When styling rules conflict:
- The last rule overrides previous rules.
- The rule with most classes and pseudo-classes overrides the last rule.
*/
// if for return
.syntax--keyword {
color: #96CBFE;
// global let def class
&.syntax--storage {
color: #96CBFE;
}
// int char float
&.syntax--type {
color: #FFFFB6;
}
// and del not
&.syntax--operator {
color: #96CBFE;
}
// super
&.syntax--function {
color: #C6C5FE;
}
// this self
&.syntax--variable {
color: #C6C5FE;
}
// = + && | << ?
&.syntax--symbolic {
color: #EDEDED;
}
}
// identifier
.syntax--entity {
color: #C5C8C6;
// variable
&.syntax--variable {
color: #C5C8C6;
}
// self cls iota
&.syntax--support {
color: #C6C5FE;
}
// @entity.decorator
&.syntax--decorator:last-child {
color: #FFD2A7;
}
// label:
&.syntax--label {
text-decoration: underline;
}
// import package
&.syntax--package {
color: #FFD2A7;
}
// function method
&.syntax--function {
color: #FFD2A7;
}
// add
&.syntax--operator {
color: #FFD2A7;
// %>% <=>
&.syntax--symbolic {
color: #EDEDED;
}
}
// String Class int rune list
&.syntax--type {
color: #FFFFB6;
}
// div span
&.syntax--tag {
color: #96CBFE;
}
// href src alt
&.syntax--attribute {
color: #FF73FD;
}
}
// () [] {} => @
.syntax--punctuation {
color: #C5C8C6;
// . ->
&.syntax--accessor.syntax--member {
color: #EDEDED;
}
}
// "string"
.syntax--string {
color: #A8FF60;
// :immutable
&.syntax--immutable {
color: #A8FF60;
}
// ${variable} %().2f
&.syntax--part {
color: #00A0A0;
}
// /^reg[ex]?p/
&.syntax--regexp {
color: #A8FF60;
&.syntax--group {
color: #A8FF60;
background-color: @syntax-background-color;
}
// \g \"
.syntax--constant.syntax--character.syntax--escape {
color: #A8FF60;
// \n \W \d .
&.syntax--code {
color: #00A0A0;
}
}
// ^ $ \b ? + i
&.syntax--language {
color: #96CBFE;
}
// <variable> \1
&.syntax--variable {
color: #C5C8C6;
}
// ( ) [^ ] (?= ) | r" /
&.syntax--punctuation {
color: #E9C062;
}
}
}
// literal true nil
.syntax--constant {
color: #FF73FD;
// 4 1.3 Infinity
&.syntax--numeric {
color: #FF73FD;
}
// &lt; 'a'
&.syntax--character {
color: #A8FF60;
// \" \' \g \.
&.syntax--escape {
color: #A8FF60;
}
// \u2661 \n \t \W .
&.syntax--code {
color: #00A0A0;
}
}
}
// text
.syntax--text {
color: #C5C8C6;
}
// __formatted__
.syntax--markup {
// # Heading
&.syntax--heading {
color: #eee;
}
// - item
&.syntax--list {
color: #555;
}
// > quote
&.syntax--quote {
color: #555;
}
// `raw`
&.syntax--raw {
color: #aaa;
}
// url.com (path)
&.syntax--link {
color: #555;
}
// [alt] ![alt]
&.syntax--alt {
color: #ddd;
}
}
// /* comment */
.syntax--comment {
color: #8A8A8A;
// @param TODO NOTE
&.syntax--caption {
color: lighten(#8A8A8A, 6);
font-weight: bold;
}
// variable function type
&.syntax--term {
color: lighten(#8A8A8A, 9);
}
// { } / .
&.syntax--punctuation {
color: #8A8A8A;
font-weight: normal;
}
}
// 0invalid
.syntax--invalid:not(.syntax--punctuation) {
// §illegal
&.syntax--illegal {
color: #FD5FF1 !important;
background-color: rgba(86, 45, 86, 0.75) !important;
}
// obsolete()
&.syntax--deprecated {
color: #FD5FF1 !important;
text-decoration: underline !important;
}
}

View File

@ -0,0 +1,106 @@
.syntax--source.syntax--css {
.syntax--entity {
// function()
&.syntax--function {
color: #C5C8C6;
// url rgb
&.syntax--support {
color: #DAD085;
}
}
// .class :pseudo-class attribute
&.syntax--selector {
color: #FF73FD;
// div span
&.syntax--tag {
color: #96CBFE;
text-decoration: underline;
}
// #id
&.syntax--id {
color: #8B98AB;
}
// .class
&.syntax--class {
color: #62B1FE;
}
}
// property: constant
&.syntax--property {
// height position border
&.syntax--support {
color: #EDEDED;
}
}
// --variable
&.syntax--variable {
color: #C6C5FE;
}
// @keyframes keyframe
&.syntax--keyframe {
color: #C6C5FE;
}
}
// property: constant
.syntax--constant {
color: #C5C8C6;
// flex solid bold
&.syntax--support {
color: #F9EE98;
}
// 4 1.3
&.syntax--numeric {
color: #99CC99;
// px % cm hz
&.syntax--unit {
color: #99CC99;
}
}
// screen print
&.syntax--media {
color: #FFD2A7;
}
// #b294bb blue red
&.syntax--color {
color: #99CC99;
}
// from to 50%
&.syntax--offset {
color: #FFD2A7;
// %
&.syntax--unit {
color: #FFD2A7;
}
}
}
// . : :: # [] ()
.syntax--punctuation {
color: #C5C8C6;
// *
&.syntax--wildcard {
color: #96CBFE;
text-decoration: underline;
}
}
}

View File

@ -0,0 +1,18 @@
.syntax--source.syntax--html {
.syntax--punctuation {
// < />
&.syntax--tag {
color: #96CBFE;
}
}
.syntax--meta {
// <!doctype html>
&.syntax--doctype {
color: #8A8A8A;
}
}
}

View File

@ -4,4 +4,7 @@
@import "styles/syntax-variables.less";
@import 'styles/editor.less';
@import 'styles/syntax.less';
@import 'styles/syntax-legacy/_base.less';
@import "styles/syntax/base.less";
@import "styles/syntax/css.less";

View File

@ -0,0 +1,232 @@
/*
This defines styling rules for syntax classes.
See the naming conventions for a list of syntax classes:
https://flight-manual.atom.io/hacking-atom/sections/syntax-naming-conventions
When styling rules conflict:
- The last rule overrides previous rules.
- The rule with most classes and pseudo-classes overrides the last rule.
*/
// if for and del = &&
.syntax--keyword {
color: #222;
font-weight: bold;
// global let def class
&.syntax--storage {
color: #222;
font-weight: bold;
}
// int char float
&.syntax--type {
color: #458;
font-weight: normal;
}
// super
&.syntax--function {
color: #008080;
}
// this self
&.syntax--variable {
color: #008080;
}
}
// identifier
.syntax--entity {
color: #555;
// function(parameter)
&.syntax--parameter {
color: #555;
}
// self cls iota
&.syntax--support {
color: #008080;
}
// @entity.decorator
&.syntax--decorator:last-child {
color: #900;
}
// label:
&.syntax--label {
text-decoration: underline;
}
// function method
&.syntax--function {
color: #900;
}
// add
&.syntax--operator {
color: #900;
// %>% <=>
&.syntax--symbolic {
color: #555;
}
}
// String Class int rune list
&.syntax--type {
color: #458;
}
// div span
&.syntax--tag {
color: #008080;
}
// href src alt
&.syntax--attribute {
color: #458;
font-weight: bold;
}
}
// () [] {} => @
.syntax--punctuation {
// . ->
&.syntax--accessor.syntax--member {
color: #222;
font-weight: bold;
}
}
// "string"
.syntax--string {
color: #D14;
// :immutable
&.syntax--immutable {
color: #D14;
}
// {placeholder} %().2f
&.syntax--part {
color: #606aa1;
}
// ${ }
&.syntax--interpolation {
color: #222;
}
// /^reg[ex]?p/
&.syntax--regexp {
color: #D14;
// ^ $ \b ? + i
&.syntax--language {
color: #222;
}
// <variable> \1
&.syntax--variable {
color: #008080;
}
// ( ) [^ ] (?= ) | r" /
&.syntax--punctuation {
color: #222;
}
}
}
// literal 4 1.3
.syntax--constant {
color: #D14;
// &lt; 'a'
&.syntax--character {
color: #D14;
// \" \' \g \.
&.syntax--escape {
color: #D14;
}
// \u2661 \n \t \W .
&.syntax--code {
color: #606aa1;
}
}
// true false nil
&.syntax--language {
color: #D14;
}
}
// text
.syntax--text {
color: #555;
}
// __formatted__
.syntax--markup {
// # Heading
&.syntax--heading {
color: #111;
}
// 1. * -
&.syntax--list.syntax--punctuation {
color: #888;
}
// url.com (path)
&.syntax--link {
color: #888;
}
}
// /* comment */
.syntax--comment {
color: #999988;
font-style: italic;
// @param TODO NOTE
&.syntax--caption {
color: lighten(#999988, 6);
font-weight: bold;
}
// variable function type
&.syntax--term {
color: lighten(#999988, 9);
}
// { } / .
&.syntax--punctuation {
color: #999988;
font-weight: normal;
}
}
// 0invalid
.syntax--invalid:not(.syntax--punctuation) {
// §illegal
&.syntax--illegal {
color: #F8F8F0 !important;
background-color: #00A8C6 !important;
}
// obsolete()
&.syntax--deprecated {
color: #F8F8F0 !important;
background-color: #8FBE00 !important;
}
}

View File

@ -0,0 +1,108 @@
.syntax--source.syntax--css {
.syntax--entity {
// function()
&.syntax--function {
color: #555;
// url rgb
&.syntax--support {
color: #458;
}
}
// .class :pseudo-class attribute
&.syntax--selector {
color: #458;
font-weight: bold;
// div span
&.syntax--tag {
color: #008080;
font-weight: normal;
}
}
// href src alt
.syntax--attribute {
color: #458;
font-weight: bold;
}
// property: constant
&.syntax--property {
color: #555;
// height position border
&.syntax--support {
font-weight: bold;
color: #333;
}
}
// --variable
&.syntax--variable {
color: #008080;
}
// @keyframes keyframe
&.syntax--keyframe {
color: #606aa1;
}
}
// property: constant
.syntax--constant {
color: #555;
// flex solid bold
&.syntax--support {
color: #099;
}
// 4 1.3
&.syntax--numeric {
color: #099;
// px % cm hz
&.syntax--unit {
color: #445588;
font-weight: bold;
}
}
// screen print
&.syntax--media {
color: #099;
}
// #b294bb blue red
&.syntax--color {
color: #099;
}
// [attribute=attribute-value]
&.syntax--attribute-value {
color: #D14;
}
}
// . : :: #
.syntax--punctuation.syntax--selector {
color: #458;
font-weight: bold;
// *
&.syntax--wildcard {
color: #008080;
font-weight: normal;
}
// []
&.syntax--attribute {
color: #555;
font-weight: normal;
}
}
}

View File

@ -5,6 +5,9 @@
@import "styles/editor.less";
@import "styles/syntax/_base.less";
@import "styles/syntax/cs.less";
@import "styles/syntax/json.less";
@import "styles/syntax-legacy/_base.less";
@import "styles/syntax-legacy/cs.less";
@import "styles/syntax-legacy/json.less";
@import "styles/syntax/base.less";
@import "styles/syntax/css.less";

View File

@ -0,0 +1,293 @@
/*
This defines styling rules for syntax classes.
See the naming conventions for a list of syntax classes:
https://flight-manual.atom.io/hacking-atom/sections/syntax-naming-conventions
When styling rules conflict:
- The last rule overrides previous rules.
- The rule with most classes and pseudo-classes overrides the last rule.
*/
// if for return
.syntax--keyword {
color: @purple;
// global let def class
&.syntax--storage {
color: @purple;
}
// int char float
&.syntax--type {
color: @yellow;
}
// and del not
&.syntax--operator {
color: @purple;
}
// super
&.syntax--function {
color: @red;
}
// this self
&.syntax--variable {
color: @red;
}
// = + && | << ?
&.syntax--symbolic {
color: @syntax-text-color;
}
}
// identifier
.syntax--entity {
color: @syntax-text-color;
// self cls iota
&.syntax--support {
color: @red;
}
// @entity.decorator
&.syntax--decorator:last-child {
color: @blue;
}
// label:
&.syntax--label {
text-decoration: underline;
}
// function method
&.syntax--function {
color: @blue;
// len print
&.syntax--support {
color: @cyan;
}
}
// add
&.syntax--operator {
color: @blue;
// %>% <=>
&.syntax--symbolic {
color: @syntax-text-color;
}
}
// String Class int rune list
&.syntax--type {
color: @yellow;
}
// div span
&.syntax--tag {
color: @red;
}
// href src alt
&.syntax--attribute {
color: @orange;
}
}
// () [] {} => @
.syntax--punctuation {
color: @syntax-text-color;
// { } ~~~
&.syntax--embedded {
color: @brown;
}
}
// "string"
.syntax--string {
color: @green;
// :immutable
&.syntax--immutable {
color: @green;
}
// {placeholder} %().2f
&.syntax--part {
color: @cyan;
}
// ${ }
&.syntax--interpolation {
color: @brown;
}
// /^reg[ex]?p/
&.syntax--regexp {
color: @green;
// ^ $ \b ? + i
&.syntax--language {
color: @purple;
}
// <variable> \1
&.syntax--variable {
color: @blue;
}
// ( ) [^ ] (?= ) | r" /
&.syntax--punctuation {
color: @brown;
}
}
}
// literal 4 1.3 true nil
.syntax--constant {
color: @orange;
// &lt; 'a'
&.syntax--character {
color: @green;
// \" \' \g \.
&.syntax--escape {
color: @green;
}
// \u2661 \n \t \W .
&.syntax--code {
color: @cyan;
}
}
}
// text
.syntax--text {
color: @syntax-text-color;
}
// __formatted__
.syntax--markup {
// # Heading
&.syntax--heading {
color: @red;
}
// 1. * -
&.syntax--list.syntax--punctuation {
color: @red;
}
// **bold**
&.syntax--bold {
color: @orange;
font-weight: bold;
}
// *italic*
&.syntax--italic {
color: @purple;
font-style: italic;
}
// `raw`
&.syntax--raw {
color: @green;
}
// url.com (path)
&.syntax--link {
color: @blue;
}
// [alt] ![alt]
&.syntax--alt {
color: @cyan;
}
// {++ inserted ++}
&.syntax--inserted {
color: @green;
.syntax--punctuation {
color: @green;
}
}
// {== highlighted ==}
&.syntax--inserted {
color: @green;
.syntax--punctuation {
color: @green;
}
}
// {-- deleted --}
&.syntax--deleted {
color: @red;
.syntax--punctuation {
color: @red;
}
}
// {~~ from~>to ~~}
&.syntax--changed {
color: @purple;
.syntax--punctuation {
color: @purple;
}
}
// {>> commented <<}
&.syntax--commented {
color: @gray;
.syntax--punctuation {
color: @gray;
}
}
}
// /* comment */
.syntax--comment {
color: @gray;
// @param TODO NOTE
&.syntax--caption {
color: lighten(@gray, 3);
font-weight: bold;
}
// variable function type
&.syntax--term {
color: lighten(@gray, 7);
}
// { } / .
&.syntax--punctuation {
color: @gray;
font-weight: normal;
}
}
// 0invalid
.syntax--invalid:not(.syntax--punctuation) {
// §illegal
&.syntax--illegal {
background-color: @red;
color: @syntax-background-color;
}
}

View File

@ -0,0 +1,113 @@
.syntax--source.syntax--css {
.syntax--entity {
// function()
&.syntax--function {
color: @syntax-text-color;
// url rgb
&.syntax--support {
color: @cyan;
}
}
// .class :pseudo-class attribute
&.syntax--selector {
color: @orange;
// div span
&.syntax--tag {
color: @red;
}
// #id
&.syntax--id {
color: @blue;
}
}
// property: constant
&.syntax--property {
color: @syntax-text-color;
}
// --variable
&.syntax--variable {
color: @red;
}
// @keyframes keyframe
&.syntax--keyframe {
color: @red;
}
}
// property: constant
.syntax--constant {
color: @syntax-text-color;
// flex solid bold
&.syntax--support {
color: @orange;
}
// 3px 4em
&.syntax--numeric {
color: @orange;
}
// screen print
&.syntax--media {
color: @orange;
}
// from to 50%
&.syntax--offset {
color: @syntax-text-color;
// %
&.syntax--unit {
color: @syntax-text-color;
}
}
// #b294bb
&.syntax--color {
color: @cyan;
// blue red
&.syntax--support {
color: @orange;
}
}
// [attribute=attribute-value]
&.syntax--attribute-value {
color: @green;
}
}
.syntax--punctuation {
// . : ::
&.syntax--selector {
color: @orange;
// *
&.syntax--wildcard {
color: @red;
}
// #
&.syntax--id {
color: @blue;
}
// []
&.syntax--attribute {
color: @syntax-text-color;
}
}
}
}

View File

@ -5,6 +5,9 @@
@import "styles/editor.less";
@import "styles/syntax/_base.less";
@import "styles/syntax/cs.less";
@import "styles/syntax/json.less";
@import "styles/syntax-legacy/_base.less";
@import "styles/syntax-legacy/cs.less";
@import "styles/syntax-legacy/json.less";
@import "styles/syntax/base.less";
@import "styles/syntax/css.less";

View File

@ -0,0 +1,293 @@
/*
This defines styling rules for syntax classes.
See the naming conventions for a list of syntax classes:
https://flight-manual.atom.io/hacking-atom/sections/syntax-naming-conventions
When styling rules conflict:
- The last rule overrides previous rules.
- The rule with most classes and pseudo-classes overrides the last rule.
*/
// if for return
.syntax--keyword {
color: @purple;
// global let def class
&.syntax--storage {
color: @purple;
}
// int char float
&.syntax--type {
color: @yellow;
}
// and del not
&.syntax--operator {
color: @purple;
}
// super
&.syntax--function {
color: @red;
}
// this self
&.syntax--variable {
color: @red;
}
// = + && | << ?
&.syntax--symbolic {
color: @syntax-text-color;
}
}
// identifier
.syntax--entity {
color: @syntax-text-color;
// self cls iota
&.syntax--support {
color: @red;
}
// @entity.decorator
&.syntax--decorator:last-child {
color: @blue;
}
// label:
&.syntax--label {
text-decoration: underline;
}
// function method
&.syntax--function {
color: @blue;
// len print
&.syntax--support {
color: @cyan;
}
}
// add
&.syntax--operator {
color: @blue;
// %>% <=>
&.syntax--symbolic {
color: @syntax-text-color;
}
}
// String Class int rune list
&.syntax--type {
color: @yellow;
}
// div span
&.syntax--tag {
color: @red;
}
// href src alt
&.syntax--attribute {
color: @orange;
}
}
// () [] {} => @
.syntax--punctuation {
color: @syntax-text-color;
// { } ~~~
&.syntax--embedded {
color: @brown;
}
}
// "string"
.syntax--string {
color: @green;
// :immutable
&.syntax--immutable {
color: @green;
}
// {placeholder} %().2f
&.syntax--part {
color: @cyan;
}
// ${ }
&.syntax--interpolation {
color: @brown;
}
// /^reg[ex]?p/
&.syntax--regexp {
color: @green;
// ^ $ \b ? + i
&.syntax--language {
color: @purple;
}
// <variable> \1
&.syntax--variable {
color: @blue;
}
// ( ) [^ ] (?= ) | r" /
&.syntax--punctuation {
color: @brown;
}
}
}
// literal 4 1.3 true nil
.syntax--constant {
color: @orange;
// &lt; 'a'
&.syntax--character {
color: @green;
// \" \' \g \.
&.syntax--escape {
color: @green;
}
// \u2661 \n \t \W .
&.syntax--code {
color: @cyan;
}
}
}
// text
.syntax--text {
color: @syntax-text-color;
}
// __formatted__
.syntax--markup {
// # Heading
&.syntax--heading {
color: @red;
}
// 1. * -
&.syntax--list.syntax--punctuation {
color: @red;
}
// **bold**
&.syntax--bold {
color: @orange;
font-weight: bold;
}
// *italic*
&.syntax--italic {
color: @purple;
font-style: italic;
}
// `raw`
&.syntax--raw {
color: @green;
}
// url.com (path)
&.syntax--link {
color: @blue;
}
// [alt] ![alt]
&.syntax--alt {
color: @cyan;
}
// {++ inserted ++}
&.syntax--inserted {
color: @green;
.syntax--punctuation {
color: @green;
}
}
// {== highlighted ==}
&.syntax--inserted {
color: @green;
.syntax--punctuation {
color: @green;
}
}
// {-- deleted --}
&.syntax--deleted {
color: @red;
.syntax--punctuation {
color: @red;
}
}
// {~~ from~>to ~~}
&.syntax--changed {
color: @purple;
.syntax--punctuation {
color: @purple;
}
}
// {>> commented <<}
&.syntax--commented {
color: @gray;
.syntax--punctuation {
color: @gray;
}
}
}
// /* comment */
.syntax--comment {
color: @gray;
// @param TODO NOTE
&.syntax--caption {
color: lighten(@gray, 3);
font-weight: bold;
}
// variable function type
&.syntax--term {
color: lighten(@gray, 7);
}
// { } / .
&.syntax--punctuation {
color: @gray;
font-weight: normal;
}
}
// 0invalid
.syntax--invalid:not(.syntax--punctuation) {
// §illegal
&.syntax--illegal {
background-color: @red;
color: @syntax-background-color;
}
}

View File

@ -0,0 +1,113 @@
.syntax--source.syntax--css {
.syntax--entity {
// function()
&.syntax--function {
color: @syntax-text-color;
// url rgb
&.syntax--support {
color: @cyan;
}
}
// .class :pseudo-class attribute
&.syntax--selector {
color: @orange;
// div span
&.syntax--tag {
color: @red;
}
// #id
&.syntax--id {
color: @blue;
}
}
// property: constant
&.syntax--property {
color: @syntax-text-color;
}
// --variable
&.syntax--variable {
color: @red;
}
// @keyframes keyframe
&.syntax--keyframe {
color: @red;
}
}
// property: constant
.syntax--constant {
color: @syntax-text-color;
// flex solid bold
&.syntax--support {
color: @orange;
}
// 3px 4em
&.syntax--numeric {
color: @orange;
}
// screen print
&.syntax--media {
color: @orange;
}
// from to 50%
&.syntax--offset {
color: @syntax-text-color;
// %
&.syntax--unit {
color: @syntax-text-color;
}
}
// #b294bb
&.syntax--color {
color: @cyan;
// blue red
&.syntax--support {
color: @orange;
}
}
// [attribute=attribute-value]
&.syntax--attribute-value {
color: @green;
}
}
.syntax--punctuation {
// . : ::
&.syntax--selector {
color: @orange;
// *
&.syntax--wildcard {
color: @red;
}
// #
&.syntax--id {
color: @blue;
}
// []
&.syntax--attribute {
color: @syntax-text-color;
}
}
}
}

View File

@ -8,7 +8,7 @@ import fs from 'fs-plus';
import Grim from 'grim';
import marked from 'marked';
import path from 'path';
import shell from 'shell';
import { shell } from 'electron';
export default class DeprecationCopView {
constructor({ uri }) {

View File

@ -1,7 +1,9 @@
const SelectListView = require('atom-select-list');
const { repositoryForPath } = require('./helpers');
'use babel';
module.exports = class DiffListView {
import SelectListView from 'atom-select-list';
import repositoryForPath from './helpers';
export default class DiffListView {
constructor() {
this.selectListView = new SelectListView({
emptyMessage: 'No diffs in file',
@ -71,7 +73,7 @@ module.exports = class DiffListView {
this.cancel();
} else if (editor) {
this.editor = editor;
const repository = repositoryForPath(this.editor.getPath());
const repository = await repositoryForPath(this.editor.getPath());
let diffs = repository
? repository.getLineDiffs(this.editor.getPath(), this.editor.getText())
: [];
@ -86,4 +88,4 @@ module.exports = class DiffListView {
this.attach();
}
}
};
}

View File

@ -1,64 +1,157 @@
const { CompositeDisposable } = require('atom');
const { repositoryForPath } = require('./helpers');
'use babel';
import { CompositeDisposable } from 'atom';
import repositoryForPath from './helpers';
const MAX_BUFFER_LENGTH_TO_DIFF = 2 * 1024 * 1024;
module.exports = class GitDiffView {
constructor(editor) {
this.updateDiffs = this.updateDiffs.bind(this);
this.editor = editor;
/**
* @describe Handles per-editor event and repository subscriptions.
* @param editor {Atom.TextEditor} - The editor this view will manage.
*/
export default class GitDiffView {
constructor(editor, editorElement) {
// These are the only members guaranteed to exist.
this.subscriptions = new CompositeDisposable();
this.decorations = {};
this.markers = [];
}
this.editor = editor;
this.editorElement = editorElement;
this.repository = null;
this.markers = new Map();
start() {
const editorElement = this.editor.getElement();
// Assign `null` to all possible child vars here so the JS engine doesn't
// have to re-evaluate the microcode when we do eventually need them.
this.releaseChildren();
this.subscribeToRepository();
// I know this looks janky but it works. Class methods are available
// before the constructor is executed. It's a micro-opt above lambdas.
const subscribeToRepository = this.subscribeToRepository.bind(this);
// WARNING: This gets handed to requestAnimationFrame, so it must be bound.
this.updateDiffs = this.updateDiffs.bind(this);
subscribeToRepository();
this.subscriptions.add(
this.editor.onDidStopChanging(this.updateDiffs),
this.editor.onDidChangePath(this.updateDiffs),
atom.project.onDidChangePaths(() => this.subscribeToRepository()),
atom.commands.add(editorElement, 'git-diff:move-to-next-diff', () =>
this.moveToNextDiff()
),
atom.commands.add(editorElement, 'git-diff:move-to-previous-diff', () =>
this.moveToPreviousDiff()
),
atom.config.onDidChange('git-diff.showIconsInEditorGutter', () =>
this.updateIconDecoration()
),
atom.config.onDidChange('editor.showLineNumbers', () =>
this.updateIconDecoration()
),
editorElement.onDidAttach(() => this.updateIconDecoration()),
this.editor.onDidDestroy(() => {
this.cancelUpdate();
this.removeDecorations();
this.subscriptions.dispose();
})
atom.project.onDidChangePaths(subscribeToRepository)
);
}
this.updateIconDecoration();
this.scheduleUpdate();
/**
* @describe Handles tear down of destructables and subscriptions.
* Does not handle release of memory. This method should only be called
* just before this object is freed, and should only tear down the main
* object components that are guarunteed to exist at all times.
*/
destroy() {
this.subscriptions.dispose();
this.destroyChildren();
this.markers.clear();
}
/**
* @describe Destroys this objects children (non-freeing), it's intended
* to be an ease-of use function for maintaing this object. This method
* should only tear down objects that are selectively allocated upon
* repository discovery.
*
* Example: this.diffs only exists when we have a repository.
*/
destroyChildren() {
if (this._animationId) cancelAnimationFrame(this._animationId);
if (this.diffs)
for (const diff of this.diffs) this.markers.get(diff).destroy();
}
/**
* @describe The memory releasing complement function of `destroyChildren`.
* frees the memory allocated at all child object storage locations
* when there is no repository.
*/
releaseChildren() {
this.diffs = null;
this._repoSubs = null;
this._animationId = null;
this.editorPath = null;
this.buffer = null;
}
/**
* @describe handles all subscriptions based on the repository in focus
*/
async subscribeToRepository() {
if (this._repoSubs !== null) {
this._repoSubs.dispose();
this.subscriptions.remove(this._repoSubs);
}
// Don't cache the path unless we know we need it.
let editorPath = this.editor.getPath();
this.repository = await repositoryForPath(editorPath);
if (this.repository !== null) {
this.editorPath = editorPath;
this.buffer = this.editor.getBuffer();
const subscribeToRepository = this.subscribeToRepository.bind(this);
const updateIconDecoration = this.updateIconDecoration.bind(this);
const scheduleUpdate = this.scheduleUpdate.bind(this);
this._repoSubs = new CompositeDisposable(
this.repository.onDidDestroy(subscribeToRepository),
this.repository.onDidChangeStatuses(scheduleUpdate),
this.repository.onDidChangeStatus(changedPath => {
if (changedPath === this.editorPath) scheduleUpdate();
}),
this.editor.onDidStopChanging(scheduleUpdate),
this.editor.onDidChangePath(() => {
this.editorPath = this.edtior.getPath();
this.buffer = this.editor.getBuffer();
scheduleUpdate();
}),
atom.commands.add(
this.editorElement,
'git-diff:move-to-next-diff',
this.moveToNextDiff.bind(this)
),
atom.commands.add(
this.editorElement,
'git-diff:move-to-previous-diff',
this.moveToPreviousDiff.bind(this)
),
atom.config.onDidChange(
'git-diff.showIconsInEditorGutter',
updateIconDecoration
),
atom.config.onDidChange('editor.showLineNumbers', updateIconDecoration),
this.editorElement.onDidAttach(updateIconDecoration)
);
// Every time the repo is changed, the editor needs to be reinitialized.
this.subscriptions.add(this._repoSubs);
updateIconDecoration();
scheduleUpdate();
} else {
this.destroyChildren();
this.releaseChildren();
}
}
moveToNextDiff() {
const cursorLineNumber = this.editor.getCursorBufferPosition().row + 1;
let nextDiffLineNumber = null;
let firstDiffLineNumber = null;
if (this.diffs) {
for (const { newStart } of this.diffs) {
if (newStart > cursorLineNumber) {
if (nextDiffLineNumber == null) nextDiffLineNumber = newStart - 1;
nextDiffLineNumber = Math.min(newStart - 1, nextDiffLineNumber);
}
if (firstDiffLineNumber == null) firstDiffLineNumber = newStart - 1;
firstDiffLineNumber = Math.min(newStart - 1, firstDiffLineNumber);
for (const { newStart } of this.diffs) {
if (newStart > cursorLineNumber) {
if (nextDiffLineNumber == null) nextDiffLineNumber = newStart - 1;
nextDiffLineNumber = Math.min(newStart - 1, nextDiffLineNumber);
}
if (firstDiffLineNumber == null) firstDiffLineNumber = newStart - 1;
firstDiffLineNumber = Math.min(newStart - 1, firstDiffLineNumber);
}
// Wrap around to the first diff in the file
@ -72,8 +165,30 @@ module.exports = class GitDiffView {
this.moveToLineNumber(nextDiffLineNumber);
}
moveToPreviousDiff() {
const cursorLineNumber = this.editor.getCursorBufferPosition().row + 1;
let previousDiffLineNumber = null;
let lastDiffLineNumber = null;
for (const { newStart } of this.diffs) {
if (newStart < cursorLineNumber) {
previousDiffLineNumber = Math.max(newStart - 1, previousDiffLineNumber);
}
lastDiffLineNumber = Math.max(newStart - 1, lastDiffLineNumber);
}
// Wrap around to the last diff in the file
if (
atom.config.get('git-diff.wrapAroundOnMoveToDiff') &&
previousDiffLineNumber === null
) {
previousDiffLineNumber = lastDiffLineNumber;
}
this.moveToLineNumber(previousDiffLineNumber);
}
updateIconDecoration() {
const gutter = this.editor.getElement().querySelector('.gutter');
const gutter = this.editorElement.querySelector('.gutter');
if (gutter) {
if (
atom.config.get('editor.showLineNumbers') &&
@ -86,108 +201,67 @@ module.exports = class GitDiffView {
}
}
moveToPreviousDiff() {
const cursorLineNumber = this.editor.getCursorBufferPosition().row + 1;
let previousDiffLineNumber = -1;
let lastDiffLineNumber = -1;
if (this.diffs) {
for (const { newStart } of this.diffs) {
if (newStart < cursorLineNumber) {
previousDiffLineNumber = Math.max(
newStart - 1,
previousDiffLineNumber
);
}
lastDiffLineNumber = Math.max(newStart - 1, lastDiffLineNumber);
}
}
// Wrap around to the last diff in the file
if (
atom.config.get('git-diff.wrapAroundOnMoveToDiff') &&
previousDiffLineNumber === -1
) {
previousDiffLineNumber = lastDiffLineNumber;
}
this.moveToLineNumber(previousDiffLineNumber);
}
moveToLineNumber(lineNumber) {
if (lineNumber != null && lineNumber >= 0) {
if (lineNumber !== null) {
this.editor.setCursorBufferPosition([lineNumber, 0]);
this.editor.moveToFirstCharacterOfLine();
}
}
subscribeToRepository() {
this.repository = repositoryForPath(this.editor.getPath());
if (this.repository) {
this.subscriptions.add(
this.repository.onDidChangeStatuses(() => {
this.scheduleUpdate();
})
);
this.subscriptions.add(
this.repository.onDidChangeStatus(changedPath => {
if (changedPath === this.editor.getPath()) this.scheduleUpdate();
})
);
}
}
cancelUpdate() {
clearImmediate(this.immediateId);
}
scheduleUpdate() {
this.cancelUpdate();
this.immediateId = setImmediate(this.updateDiffs);
// Use Chromium native requestAnimationFrame because it yields
// to the browser, is standard and doesn't involve extra JS overhead.
if (this._animationId) cancelAnimationFrame(this._animationId);
this._animationId = requestAnimationFrame(this.updateDiffs);
}
/**
* @describe Uses text markers in the target editor to visualize
* git modifications, additions, and deletions. The current algorithm
* just redraws the markers each call.
*/
updateDiffs() {
if (this.editor.isDestroyed()) return;
this.removeDecorations();
const path = this.editor && this.editor.getPath();
if (
path &&
this.editor.getBuffer().getLength() < MAX_BUFFER_LENGTH_TO_DIFF
) {
this.diffs =
this.repository &&
this.repository.getLineDiffs(path, this.editor.getText());
if (this.diffs) this.addDecorations(this.diffs);
}
}
if (this.buffer.getLength() < MAX_BUFFER_LENGTH_TO_DIFF) {
// Before we redraw the diffs, tear down the old markers.
if (this.diffs)
for (const diff of this.diffs) this.markers.get(diff).destroy();
addDecorations(diffs) {
for (const { newStart, oldLines, newLines } of diffs) {
const startRow = newStart - 1;
const endRow = newStart + newLines - 1;
if (oldLines === 0 && newLines > 0) {
this.markRange(startRow, endRow, 'git-line-added');
} else if (newLines === 0 && oldLines > 0) {
if (startRow < 0) {
this.markRange(0, 0, 'git-previous-line-removed');
this.markers.clear();
const text = this.buffer.getText();
this.diffs = this.repository.getLineDiffs(this.editorPath, text);
this.diffs = this.diffs || []; // Sanitize type to array.
for (const diff of this.diffs) {
const { newStart, oldLines, newLines } = diff;
const startRow = newStart - 1;
const endRow = newStart + newLines - 1;
let mark;
if (oldLines === 0 && newLines > 0) {
mark = this.markRange(startRow, endRow, 'git-line-added');
} else if (newLines === 0 && oldLines > 0) {
if (startRow < 0) {
mark = this.markRange(0, 0, 'git-previous-line-removed');
} else {
mark = this.markRange(startRow, startRow, 'git-line-removed');
}
} else {
this.markRange(startRow, startRow, 'git-line-removed');
mark = this.markRange(startRow, endRow, 'git-line-modified');
}
} else {
this.markRange(startRow, endRow, 'git-line-modified');
this.markers.set(diff, mark);
}
}
}
removeDecorations() {
for (let marker of this.markers) marker.destroy();
this.markers = [];
}
markRange(startRow, endRow, klass) {
const marker = this.editor.markBufferRange([[startRow, 0], [endRow, 0]], {
invalidate: 'never'
});
this.editor.decorateMarker(marker, { type: 'line-number', class: klass });
this.markers.push(marker);
return marker;
}
};
}

View File

@ -1,11 +1,10 @@
exports.repositoryForPath = function(goalPath) {
const directories = atom.project.getDirectories();
const repositories = atom.project.getRepositories();
for (let i = 0; i < directories.length; i++) {
const directory = directories[i];
'use babel';
export default async function(goalPath) {
for (const directory of atom.project.getDirectories()) {
if (goalPath === directory.getPath() || directory.contains(goalPath)) {
return repositories[i];
return atom.project.repositoryForDirectory(directory);
}
}
return null;
};
}

View File

@ -1,32 +1,52 @@
const GitDiffView = require('./git-diff-view');
const DiffListView = require('./diff-list-view');
'use babel';
import { CompositeDisposable } from 'atom';
import GitDiffView from './git-diff-view';
import DiffListView from './diff-list-view';
let diffListView = null;
let diffViews = new Set();
let subscriptions = null;
module.exports = {
activate() {
const watchedEditors = new WeakSet();
export default {
activate(state) {
subscriptions = new CompositeDisposable();
atom.workspace.observeTextEditors(editor => {
if (watchedEditors.has(editor)) return;
subscriptions.add(
atom.workspace.observeTextEditors(editor => {
const editorElement = atom.views.getView(editor);
const diffView = new GitDiffView(editor, editorElement);
new GitDiffView(editor).start();
atom.commands.add(
atom.views.getView(editor),
'git-diff:toggle-diff-list',
() => {
if (diffListView == null) diffListView = new DiffListView();
diffListView.toggle();
}
);
diffViews.add(diffView);
watchedEditors.add(editor);
editor.onDidDestroy(() => watchedEditors.delete(editor));
});
const listViewCommand = 'git-diff:toggle-diff-list';
const editorSubs = new CompositeDisposable(
atom.commands.add(editorElement, listViewCommand, () => {
if (diffListView == null) diffListView = new DiffListView();
diffListView.toggle();
}),
editor.onDidDestroy(() => {
diffView.destroy();
diffViews.delete(diffView);
editorSubs.dispose();
subscriptions.remove(editorSubs);
})
);
subscriptions.add(editorSubs);
})
);
},
deactivate() {
if (diffListView) diffListView.destroy();
diffListView = null;
for (const diffView of diffViews) diffView.destroy();
diffViews.clear();
subscriptions.dispose();
subscriptions = null;
}
};

View File

@ -9,27 +9,11 @@
"atom": "*"
},
"dependencies": {
"atom-select-list": "^0.7.0",
"fs-plus": "^3.0.0",
"temp": "~0.8.1"
"atom-select-list": "^0.7.0"
},
"devDependencies": {
"standard": "^11.0.0"
},
"standard": {
"ignore": [
"spec/fixtures/working-dir/sample.js"
],
"env": {
"atomtest": true,
"browser": true,
"jasmine": true,
"node": true
},
"globals": [
"atom",
"snapshotResult"
]
"fs-plus": "^3.0.0",
"temp": "~0.8.1"
},
"configSchema": {
"showIconsInEditorGutter": {

View File

@ -1,6 +1,6 @@
const path = require('path');
const fs = require('fs-plus');
const temp = require('temp');
const temp = require('temp').track();
describe('git-diff:toggle-diff-list', () => {
let diffListView, editor;

View File

@ -1,12 +1,17 @@
const path = require('path');
const fs = require('fs-plus');
const temp = require('temp');
const temp = require('temp').track();
describe('GitDiff package', () => {
let editor, editorElement, projectPath;
let editor, editorElement, projectPath, screenUpdates;
beforeEach(() => {
spyOn(window, 'setImmediate').andCallFake(fn => fn());
screenUpdates = 0;
spyOn(window, 'requestAnimationFrame').andCallFake(fn => {
fn();
screenUpdates++;
});
spyOn(window, 'cancelAnimationFrame').andCallFake(i => null);
projectPath = temp.mkdirSync('git-diff-spec-');
const otherPath = temp.mkdirSync('some-other-path-');
@ -20,16 +25,26 @@ describe('GitDiff package', () => {
jasmine.attachToDOM(atom.workspace.getElement());
waitsForPromise(() =>
atom.workspace.open(path.join(projectPath, 'sample.js'))
);
waitsForPromise(async () => {
await atom.workspace.open(path.join(projectPath, 'sample.js'));
await atom.packages.activatePackage('git-diff');
});
runs(() => {
editor = atom.workspace.getActiveTextEditor();
editorElement = editor.getElement();
editorElement = atom.views.getView(editor);
});
});
waitsForPromise(() => atom.packages.activatePackage('git-diff'));
afterEach(() => {
temp.cleanup();
});
describe('when the editor has no changes', () => {
it("doesn't mark the editor", () => {
waitsFor(() => screenUpdates > 0);
runs(() => expect(editor.getMarkers().length).toBe(0));
});
});
describe('when the editor has modified lines', () => {
@ -39,13 +54,17 @@ describe('GitDiff package', () => {
);
editor.insertText('a');
advanceClock(editor.getBuffer().stoppedChangingDelay);
expect(editorElement.querySelectorAll('.git-line-modified').length).toBe(
1
);
expect(editorElement.querySelector('.git-line-modified')).toHaveData(
'buffer-row',
0
);
waitsFor(() => editor.getMarkers().length > 0);
runs(() => {
expect(
editorElement.querySelectorAll('.git-line-modified').length
).toBe(1);
expect(editorElement.querySelector('.git-line-modified')).toHaveData(
'buffer-row',
0
);
});
});
});
@ -56,11 +75,16 @@ describe('GitDiff package', () => {
editor.insertNewline();
editor.insertText('a');
advanceClock(editor.getBuffer().stoppedChangingDelay);
expect(editorElement.querySelectorAll('.git-line-added').length).toBe(1);
expect(editorElement.querySelector('.git-line-added')).toHaveData(
'buffer-row',
1
);
waitsFor(() => editor.getMarkers().length > 0);
runs(() => {
expect(editorElement.querySelectorAll('.git-line-added').length).toBe(
1
);
expect(editorElement.querySelector('.git-line-added')).toHaveData(
'buffer-row',
1
);
});
});
});
@ -70,13 +94,16 @@ describe('GitDiff package', () => {
editor.setCursorBufferPosition([5]);
editor.deleteLine();
advanceClock(editor.getBuffer().stoppedChangingDelay);
expect(editorElement.querySelectorAll('.git-line-removed').length).toBe(
1
);
expect(editorElement.querySelector('.git-line-removed')).toHaveData(
'buffer-row',
4
);
waitsFor(() => editor.getMarkers().length > 0);
runs(() => {
expect(editorElement.querySelectorAll('.git-line-removed').length).toBe(
1
);
expect(editorElement.querySelector('.git-line-removed')).toHaveData(
'buffer-row',
4
);
});
});
});
@ -86,12 +113,15 @@ describe('GitDiff package', () => {
editor.setCursorBufferPosition([0, 0]);
editor.deleteLine();
advanceClock(editor.getBuffer().stoppedChangingDelay);
expect(
editorElement.querySelectorAll('.git-previous-line-removed').length
).toBe(1);
expect(
editorElement.querySelector('.git-previous-line-removed')
).toHaveData('buffer-row', 0);
waitsFor(() => editor.getMarkers().length > 0);
runs(() => {
expect(
editorElement.querySelectorAll('.git-previous-line-removed').length
).toBe(1);
expect(
editorElement.querySelector('.git-previous-line-removed')
).toHaveData('buffer-row', 0);
});
});
});
@ -102,14 +132,24 @@ describe('GitDiff package', () => {
);
editor.insertText('a');
advanceClock(editor.getBuffer().stoppedChangingDelay);
expect(editorElement.querySelectorAll('.git-line-modified').length).toBe(
1
waitsFor(
() => editorElement.querySelectorAll('.git-line-modified').length > 0
);
editor.backspace();
advanceClock(editor.getBuffer().stoppedChangingDelay);
expect(editorElement.querySelectorAll('.git-line-modified').length).toBe(
0
runs(() => {
expect(
editorElement.querySelectorAll('.git-line-modified').length
).toBe(1);
editor.backspace();
advanceClock(editor.getBuffer().stoppedChangingDelay);
});
waitsFor(
() => editorElement.querySelectorAll('.git-line-modified').length < 1
);
runs(() => {
expect(
editorElement.querySelectorAll('.git-line-modified').length
).toBe(0);
});
});
});
@ -119,21 +159,17 @@ describe('GitDiff package', () => {
path.join(projectPath, 'sample.txt'),
'Some different text.'
);
let nextTick = false;
waitsForPromise(() =>
atom.workspace.open(path.join(projectPath, 'sample.txt'))
);
runs(() => {
editorElement = atom.workspace.getActiveTextEditor().getElement();
editor = atom.workspace.getActiveTextEditor();
editorElement = editor.getElement();
});
setImmediate(() => {
nextTick = true;
});
waitsFor(() => nextTick);
waitsFor(() => editor.getMarkers().length > 0);
runs(() => {
expect(
@ -152,39 +188,49 @@ describe('GitDiff package', () => {
editor.deleteLine();
atom.project.setPaths([temp.mkdirSync('no-repository')]);
advanceClock(editor.getBuffer().stoppedChangingDelay);
waitsFor(() => editor.getMarkers().length === 0);
runs(() => {
expect(editor.getMarkers().length).toBe(0);
});
});
});
describe('move-to-next-diff/move-to-previous-diff events', () => {
it('moves the cursor to first character of the next/previous diff line', () => {
editor.insertText('a');
editor.setCursorBufferPosition([5]);
editor.deleteLine();
advanceClock(editor.getBuffer().stoppedChangingDelay);
waitsFor(() => editor.getMarkers().length > 0);
runs(() => {
editor.setCursorBufferPosition([5]);
editor.deleteLine();
advanceClock(editor.getBuffer().stoppedChangingDelay);
editor.setCursorBufferPosition([0]);
atom.commands.dispatch(editorElement, 'git-diff:move-to-next-diff');
expect(editor.getCursorBufferPosition()).toEqual([4, 4]);
editor.setCursorBufferPosition([0]);
atom.commands.dispatch(editorElement, 'git-diff:move-to-next-diff');
expect(editor.getCursorBufferPosition()).toEqual([4, 4]);
atom.commands.dispatch(editorElement, 'git-diff:move-to-previous-diff');
expect(editor.getCursorBufferPosition()).toEqual([0, 0]);
atom.commands.dispatch(editorElement, 'git-diff:move-to-previous-diff');
expect(editor.getCursorBufferPosition()).toEqual([0, 0]);
});
});
it('wraps around to the first/last diff in the file', () => {
editor.insertText('a');
editor.setCursorBufferPosition([5]);
editor.deleteLine();
advanceClock(editor.getBuffer().stoppedChangingDelay);
waitsFor(() => editor.getMarkers().length > 0);
runs(() => {
editor.setCursorBufferPosition([5]);
editor.deleteLine();
advanceClock(editor.getBuffer().stoppedChangingDelay);
editor.setCursorBufferPosition([0]);
atom.commands.dispatch(editorElement, 'git-diff:move-to-next-diff');
expect(editor.getCursorBufferPosition()).toEqual([4, 4]);
editor.setCursorBufferPosition([0]);
atom.commands.dispatch(editorElement, 'git-diff:move-to-next-diff');
expect(editor.getCursorBufferPosition().toArray()).toEqual([4, 4]);
atom.commands.dispatch(editorElement, 'git-diff:move-to-next-diff');
expect(editor.getCursorBufferPosition()).toEqual([0, 0]);
atom.commands.dispatch(editorElement, 'git-diff:move-to-next-diff');
expect(editor.getCursorBufferPosition().toArray()).toEqual([0, 0]);
atom.commands.dispatch(editorElement, 'git-diff:move-to-previous-diff');
expect(editor.getCursorBufferPosition()).toEqual([4, 4]);
atom.commands.dispatch(editorElement, 'git-diff:move-to-previous-diff');
expect(editor.getCursorBufferPosition().toArray()).toEqual([4, 4]);
});
});
describe('when the wrapAroundOnMoveToDiff config option is false', () => {
@ -197,19 +243,28 @@ describe('GitDiff package', () => {
editor.setCursorBufferPosition([5]);
editor.deleteLine();
advanceClock(editor.getBuffer().stoppedChangingDelay);
waitsFor(() => editor.getMarkers().length > 0);
editor.setCursorBufferPosition([0]);
atom.commands.dispatch(editorElement, 'git-diff:move-to-next-diff');
expect(editor.getCursorBufferPosition()).toEqual([4, 4]);
runs(() => {
editor.setCursorBufferPosition([0]);
atom.commands.dispatch(editorElement, 'git-diff:move-to-next-diff');
expect(editor.getCursorBufferPosition()).toEqual([4, 4]);
atom.commands.dispatch(editorElement, 'git-diff:move-to-next-diff');
expect(editor.getCursorBufferPosition()).toEqual([4, 4]);
atom.commands.dispatch(editorElement, 'git-diff:move-to-next-diff');
expect(editor.getCursorBufferPosition()).toEqual([4, 4]);
atom.commands.dispatch(editorElement, 'git-diff:move-to-previous-diff');
expect(editor.getCursorBufferPosition()).toEqual([0, 0]);
atom.commands.dispatch(
editorElement,
'git-diff:move-to-previous-diff'
);
expect(editor.getCursorBufferPosition()).toEqual([0, 0]);
atom.commands.dispatch(editorElement, 'git-diff:move-to-previous-diff');
expect(editor.getCursorBufferPosition()).toEqual([0, 0]);
atom.commands.dispatch(
editorElement,
'git-diff:move-to-previous-diff'
);
expect(editor.getCursorBufferPosition()).toEqual([0, 0]);
});
});
});
});
@ -219,28 +274,40 @@ describe('GitDiff package', () => {
atom.config.set('git-diff.showIconsInEditorGutter', true);
});
it('the gutter has a git-diff-icon class', () =>
expect(editorElement.querySelector('.gutter')).toHaveClass(
'git-diff-icon'
));
it('the gutter has a git-diff-icon class', () => {
waitsFor(() => screenUpdates > 0);
runs(() => {
expect(editorElement.querySelector('.gutter')).toHaveClass(
'git-diff-icon'
);
});
});
it('keeps the git-diff-icon class when editor.showLineNumbers is toggled', () => {
atom.config.set('editor.showLineNumbers', false);
expect(editorElement.querySelector('.gutter')).not.toHaveClass(
'git-diff-icon'
);
waitsFor(() => screenUpdates > 0);
atom.config.set('editor.showLineNumbers', true);
expect(editorElement.querySelector('.gutter')).toHaveClass(
'git-diff-icon'
);
runs(() => {
atom.config.set('editor.showLineNumbers', false);
expect(editorElement.querySelector('.gutter')).not.toHaveClass(
'git-diff-icon'
);
atom.config.set('editor.showLineNumbers', true);
expect(editorElement.querySelector('.gutter')).toHaveClass(
'git-diff-icon'
);
});
});
it('removes the git-diff-icon class when the showIconsInEditorGutter config option set to false', () => {
atom.config.set('git-diff.showIconsInEditorGutter', false);
expect(editorElement.querySelector('.gutter')).not.toHaveClass(
'git-diff-icon'
);
waitsFor(() => screenUpdates > 0);
runs(() => {
atom.config.set('git-diff.showIconsInEditorGutter', false);
expect(editorElement.querySelector('.gutter')).not.toHaveClass(
'git-diff-icon'
);
});
});
});
});

View File

@ -0,0 +1,48 @@
const path = require('path');
const fs = require('fs-plus');
const temp = require('temp').track();
const commands = [
'git-diff:toggle-diff-list',
'git-diff:move-to-next-diff',
'git-diff:move-to-previous-diff'
];
describe('git-diff', () => {
let editor, element;
beforeEach(() => {
const projectPath = temp.mkdirSync('git-diff-spec-');
fs.copySync(path.join(__dirname, 'fixtures', 'working-dir'), projectPath);
fs.moveSync(
path.join(projectPath, 'git.git'),
path.join(projectPath, '.git')
);
atom.project.setPaths([projectPath]);
jasmine.attachToDOM(atom.workspace.getElement());
waitsForPromise(() => atom.workspace.open('sample.js'));
runs(() => {
editor = atom.workspace.getActiveTextEditor();
element = atom.views.getView(editor);
});
});
describe('When the module is deactivated', () => {
it('removes all registered command hooks after deactivation.', () => {
waitsForPromise(() => atom.packages.activatePackage('git-diff'));
waitsForPromise(() => atom.packages.deactivatePackage('git-diff'));
runs(() => {
// NOTE: don't use enable and disable from the Public API.
expect(atom.packages.isPackageActive('git-diff')).toBe(false);
atom.commands
.findCommands({ target: element })
.filter(({ name }) => commands.includes(name))
.forEach(command => expect(commands).not.toContain(command.name));
});
});
});
});

View File

@ -75,7 +75,7 @@ describe('GoToLine', () => {
goToLine.miniEditor.insertText('45:4');
atom.commands.dispatch(goToLine.miniEditor.element, 'core:confirm');
const rowsPerPage = editor.getRowsPerPage();
const currentRow = editor.getCursorBufferPosition().row - 1;
const currentRow = editor.getCursorBufferPosition().row;
expect(editor.getFirstVisibleScreenRow()).toBe(
currentRow - Math.ceil(rowsPerPage / 2)
);

View File

@ -11,7 +11,7 @@
"repository": "https://github.com/atom/atom",
"license": "MIT",
"dependencies": {
"tree-sitter-rust": "^0.16.0"
"tree-sitter-rust": "^0.17.0"
},
"engines": {
"atom": ">=1.0.0 <2.0.0"

View File

@ -2,7 +2,7 @@
import _ from 'underscore-plus';
import { CompositeDisposable, Disposable } from 'atom';
import SelectListView from 'atom-select-list';
import { Selector } from './selector';
import StatusBarItem from './status-bar-item';
import helpers from './helpers';
@ -16,53 +16,28 @@ const LFRegExp = /(\A|[^\r])\n/g;
const CRLFRegExp = /\r\n/g;
let disposables = null;
let modalPanel = null;
let lineEndingListView = null;
export function activate() {
disposables = new CompositeDisposable();
let selectorDisposable;
let selector;
disposables.add(
atom.commands.add('atom-text-editor', {
'line-ending-selector:show': event => {
if (!modalPanel) {
lineEndingListView = new SelectListView({
items: [
{ name: 'LF', value: '\n' },
{ name: 'CRLF', value: '\r\n' }
],
filterKeyForItem: lineEnding => lineEnding.name,
didConfirmSelection: lineEnding => {
setLineEnding(
atom.workspace.getActiveTextEditor(),
lineEnding.value
);
modalPanel.hide();
},
didCancelSelection: () => {
modalPanel.hide();
},
elementForItem: lineEnding => {
const element = document.createElement('li');
element.textContent = lineEnding.name;
return element;
}
});
modalPanel = atom.workspace.addModalPanel({
item: lineEndingListView
});
disposables.add(
new Disposable(() => {
lineEndingListView.destroy();
modalPanel.destroy();
modalPanel = null;
})
);
'line-ending-selector:show': () => {
// Initiating Selector object - called only once when `line-ending-selector:show` is called
if (!selectorDisposable) {
// make a Selector object
selector = new Selector([
{ name: 'LF', value: '\n' },
{ name: 'CRLF', value: '\r\n' }
]);
// Add disposable for selector
selectorDisposable = new Disposable(() => selector.dispose());
disposables.add(selectorDisposable);
}
lineEndingListView.reset();
modalPanel.show();
lineEndingListView.focus();
selector.show();
},
'line-ending-selector:convert-to-LF': event => {
@ -187,7 +162,7 @@ function getLineEndings(buffer) {
}
}
function setLineEnding(item, lineEnding) {
export function setLineEnding(item, lineEnding) {
if (item && item.getBuffer) {
let buffer = item.getBuffer();
buffer.setPreferredLineEnding(lineEnding);

View File

@ -0,0 +1,77 @@
'use babel';
import SelectListView from 'atom-select-list';
import { TextEditor } from 'atom';
import { setLineEnding } from './main';
export class Selector {
lineEndingListView;
modalPanel;
previousActivePane;
// Make a selector object (should be called once)
constructor(selectorItems) {
// Defining a SelectListView with methods - https://github.com/atom/atom-select-list
this.lineEndingListView = new SelectListView({
// an array containing the objects you want to show in the select list
items: selectorItems,
// called whenever an item needs to be displayed.
elementForItem: lineEnding => {
const element = document.createElement('li');
element.textContent = lineEnding.name;
return element;
},
// called to retrieve a string property on each item and that will be used to filter them.
filterKeyForItem: lineEnding => {
return lineEnding.name;
},
// called when the user clicks or presses Enter on an item. // use `=>` for `this`
didConfirmSelection: lineEnding => {
const editor = atom.workspace.getActiveTextEditor();
if (editor instanceof TextEditor) {
setLineEnding(editor, lineEnding.value);
}
this.hide();
},
// called when the user presses Esc or the list loses focus. // use `=>` for `this`
didCancelSelection: () => {
this.hide();
}
});
// Adding SelectListView to panel
this.modalPanel = atom.workspace.addModalPanel({
item: this.lineEndingListView
});
}
// Show a selector object
show() {
this.previousActivePane = atom.workspace.getActivePane();
// Show selector
this.lineEndingListView.reset();
this.modalPanel.show();
this.lineEndingListView.focus();
}
// Hide a selector
hide() {
// hide modal panel
this.modalPanel.hide();
// focus on the previous active pane
this.previousActivePane.activate();
}
// Dispose selector
dispose() {
this.lineEndingListView.destroy();
this.modalPanel.destroy();
this.modalPanel = null;
}
}

View File

@ -5,20 +5,23 @@
@import "styles/editor.less";
@import "styles/syntax/_base.less";
@import "styles/syntax/c.less";
@import "styles/syntax/cpp.less";
@import "styles/syntax/cs.less";
@import "styles/syntax-legacy/_base.less";
// @import "styles/syntax-legacy/c.less";
// @import "styles/syntax-legacy/cpp.less";
@import "styles/syntax-legacy/cs.less";
@import "styles/syntax-legacy/css.less";
@import "styles/syntax-legacy/elixir.less";
@import "styles/syntax-legacy/gfm.less";
// @import "styles/syntax-legacy/go.less";
@import "styles/syntax-legacy/ini.less";
@import "styles/syntax-legacy/java.less";
// @import "styles/syntax-legacy/javascript.less";
@import "styles/syntax-legacy/typescript.less";
@import "styles/syntax-legacy/json.less";
@import "styles/syntax-legacy/ng.less";
// @import "styles/syntax-legacy/ruby.less";
@import "styles/syntax-legacy/php.less";
// @import "styles/syntax-legacy/python.less";
@import "styles/syntax/base.less";
@import "styles/syntax/css.less";
@import "styles/syntax/elixir.less";
@import "styles/syntax/gfm.less";
@import "styles/syntax/go.less";
@import "styles/syntax/ini.less";
@import "styles/syntax/java.less";
@import "styles/syntax/javascript.less";
@import "styles/syntax/typescript.less";
@import "styles/syntax/json.less";
@import "styles/syntax/ng.less";
@import "styles/syntax/ruby.less";
@import "styles/syntax/php.less";
@import "styles/syntax/python.less";

View File

@ -0,0 +1,10 @@
.syntax--source.syntax--css {
// highlight properties/values if they are supported
.syntax--property-name,
.syntax--property-value {
color: @mono-2;
&.syntax--support {
color: @mono-1;
}
}
}

View File

@ -0,0 +1,312 @@
/*
This defines styling rules for syntax classes.
See the naming conventions for a list of syntax classes:
https://flight-manual.atom.io/hacking-atom/sections/syntax-naming-conventions
When styling rules conflict:
- The last rule overrides previous rules.
- The rule with most classes and pseudo-classes overrides the last rule.
*/
// if for and del let = &&
.syntax--keyword {
color: @hue-3;
// int char float
&.syntax--type {
color: @hue-1;
}
// super
&.syntax--function {
color: @hue-5;
}
// this self
&.syntax--variable {
color: @hue-5;
}
}
// identifier
.syntax--entity {
color: @mono-1;
// function(parameter)
&.syntax--parameter {
color: @mono-1;
}
// self cls iota
&.syntax--support {
color: @hue-5;
}
// @entity.decorator
&.syntax--decorator:last-child {
color: @hue-2;
}
// label:
&.syntax--label {
text-decoration: underline;
}
// function method
&.syntax--function {
color: @hue-2;
}
// add
&.syntax--operator {
color: @hue-2;
// %>% <=>
&.syntax--symbolic {
color: @mono-1;
}
}
// String Class int rune list
&.syntax--type {
color: @hue-1;
}
// div span
&.syntax--tag {
color: @hue-5;
}
// href src alt
&.syntax--attribute {
color: @hue-6;
}
}
// () [] {} => @
.syntax--punctuation {
color: @mono-1;
&.syntax--accessor {
color: @mono-1;
// . -> ::
&.syntax--member,
&.syntax--scope {
color: @hue-3;
}
}
// { } ~~~
&.syntax--embedded {
color: @hue-3;
}
}
// "string"
.syntax--string {
color: @hue-4;
// :immutable
&.syntax--immutable {
color: @hue-4;
}
// {placeholder} %().2f
&.syntax--part {
color: @hue-1;
}
// ${ }
&.syntax--interpolation {
color: @hue-3;
}
// /^reg[ex]?p/
&.syntax--regexp {
color: @hue-4;
// ^ $ \b ? + i
&.syntax--language {
color: @hue-3;
}
// <variable> \1
&.syntax--variable {
color: @hue-2;
}
// ( ) [^ ] (?= ) |
&.syntax--punctuation {
color: @hue-3;
}
}
}
// literal 4 1.3 true nil
.syntax--constant {
color: @hue-6;
// &lt; 'a'
&.syntax--character {
color: @hue-4;
// \" \' \g \.
&.syntax--escape {
color: @hue-4;
}
// \u2661 \n \t \W .
&.syntax--code {
color: @hue-1;
}
}
}
// text
.syntax--text {
color: @mono-1;
}
// __formatted__
.syntax--markup {
// # Heading
&.syntax--heading {
color: @hue-5;
}
// 1. * -
&.syntax--list.syntax--punctuation {
color: @hue-5;
}
// > quote
&.syntax--quote {
color: @mono-3;
font-style: italic;
}
// **bold**
&.syntax--bold {
color: @hue-6;
font-weight: bold;
}
// *italic*
&.syntax--italic {
color: @hue-3;
font-style: italic;
}
// __underline__
&.syntax--underline {
color: @hue-1;
text-decoration: underline;
}
// ~~strike~~
&.syntax--strike {
color: @hue-5;
}
// `raw`
&.syntax--raw {
color: @hue-4;
}
// url.com (path)
&.syntax--link {
color: @hue-1;
}
// [alt] ![alt]
&.syntax--alt {
color: @hue-2;
}
// {++ inserted ++}
&.syntax--inserted {
color: @hue-4;
.syntax--punctuation {
color: @hue-4;
}
}
// {== highlighted ==}
&.syntax--highlighted {
color: @hue-4;
.syntax--punctuation {
color: @hue-4;
}
}
// {-- deleted --}
&.syntax--deleted {
color: @hue-5;
.syntax--punctuation {
color: @hue-5;
}
}
// {~~ from~>to ~~}
&.syntax--changed {
color: @hue-3;
.syntax--punctuation {
color: @hue-3;
}
}
// {>> commented <<}
&.syntax--commented {
color: @mono-3;
.syntax--punctuation {
color: @mono-3;
}
}
}
// /* comment */
.syntax--comment {
color: @mono-3;
font-style: italic;
// @param TODO NOTE
&.syntax--caption {
color: lighten(@mono-3, 6);
font-weight: bold;
}
// variable function type
&.syntax--term {
color: lighten(@mono-3, 9);
}
// { } / .
&.syntax--punctuation {
color: @mono-3;
font-weight: normal;
}
}
// 0invalid
.syntax--invalid:not(.syntax--punctuation) {
// §illegal
&.syntax--illegal {
color: @syntax-illegal-fg !important;
background-color: @syntax-illegal-bg !important;
}
// obsolete()
&.syntax--deprecated {
color: @syntax-deprecated-fg !important;
background-color: @syntax-deprecated-bg !important;
}
}

View File

@ -1,10 +1,103 @@
.syntax--source.syntax--css {
// highlight properties/values if they are supported
.syntax--property-name,
.syntax--property-value {
.syntax--entity {
// function()
&.syntax--function {
color: @mono-2;
// url rgb
&.syntax--support {
color: @hue-1;
}
}
// .class :pseudo-class attribute
&.syntax--selector {
color: @hue-6;
// div span
&.syntax--tag {
color: @hue-5;
}
// #id
&.syntax--id {
color: @hue-2;
}
}
// property: constant
&.syntax--property {
color: @mono-2;
// height position border
&.syntax--support {
color: @mono-1;
}
}
// --variable
&.syntax--variable {
color: @hue-5;
}
}
// property: constant
.syntax--constant {
color: @mono-2;
// flex solid bold
&.syntax--support {
color: @mono-1;
}
// 3px 4em
&.syntax--numeric {
color: @hue-6;
}
// screen print
&.syntax--media {
color: @hue-6;
}
// #b294bb blue red
&.syntax--color {
color: @hue-6;
}
// from to
&.syntax--offset {
color: @mono-1;
}
// [attribute=attribute-value]
&.syntax--attribute-value {
color: @hue-4;
}
}
.syntax--punctuation {
// . : ::
&.syntax--selector {
color: @hue-6;
// *
&.syntax--wildcard {
color: @hue-5;
}
// #
&.syntax--id {
color: @hue-2;
}
// []
&.syntax--attribute {
color: @mono-1;
}
}
}
}

View File

@ -5,20 +5,23 @@
@import "styles/editor.less";
@import "styles/syntax/_base.less";
@import "styles/syntax/c.less";
@import "styles/syntax/cpp.less";
@import "styles/syntax/cs.less";
@import "styles/syntax-legacy/_base.less";
// @import "styles/syntax-legacy/c.less";
// @import "styles/syntax-legacy/cpp.less";
@import "styles/syntax-legacy/cs.less";
@import "styles/syntax-legacy/css.less";
@import "styles/syntax-legacy/elixir.less";
@import "styles/syntax-legacy/gfm.less";
// @import "styles/syntax-legacy/go.less";
@import "styles/syntax-legacy/ini.less";
@import "styles/syntax-legacy/java.less";
// @import "styles/syntax-legacy/javascript.less";
@import "styles/syntax-legacy/typescript.less";
@import "styles/syntax-legacy/json.less";
@import "styles/syntax-legacy/ng.less";
// @import "styles/syntax-legacy/ruby.less";
@import "styles/syntax-legacy/php.less";
// @import "styles/syntax-legacy/python.less";
@import "styles/syntax/base.less";
@import "styles/syntax/css.less";
@import "styles/syntax/elixir.less";
@import "styles/syntax/gfm.less";
@import "styles/syntax/go.less";
@import "styles/syntax/ini.less";
@import "styles/syntax/java.less";
@import "styles/syntax/javascript.less";
@import "styles/syntax/typescript.less";
@import "styles/syntax/json.less";
@import "styles/syntax/ng.less";
@import "styles/syntax/ruby.less";
@import "styles/syntax/php.less";
@import "styles/syntax/python.less";

View File

@ -19,8 +19,8 @@
@hue-5: hsl( 5, 74%, 59%); // <-red 1
@hue-5-2: hsl(344, 84%, 43%); // <-red 2
@hue-6: hsl(41, 99%, 30%); // <-orange 1
@hue-6-2: hsl(41, 99%, 38%); // <-orange 2
@hue-6: hsl(35, 99%, 36%); // <-orange 1
@hue-6-2: hsl(35, 99%, 40%); // <-orange 2
// Base colors -----------------------------------

View File

@ -0,0 +1,12 @@
.syntax--source.syntax--css {
// highlight properties/values if they are supported
.syntax--property-name,
.syntax--property-value {
color: @mono-2;
&.syntax--support {
color: @mono-1;
}
}
}

View File

@ -0,0 +1,312 @@
/*
This defines styling rules for syntax classes.
See the naming conventions for a list of syntax classes:
https://flight-manual.atom.io/hacking-atom/sections/syntax-naming-conventions
When styling rules conflict:
- The last rule overrides previous rules.
- The rule with most classes and pseudo-classes overrides the last rule.
*/
// if for return global let
.syntax--keyword {
color: @hue-3;
// int char float
&.syntax--type {
color: @hue-1;
}
// and or new del
&.syntax--operator {
color: @hue-3;
}
// super
&.syntax--function {
color: @hue-5;
}
// this self
&.syntax--variable {
color: @hue-5;
}
// = + && | << ?
&.syntax--symbolic {
color: @mono-1;
}
}
// identifier
.syntax--entity {
color: @mono-1;
// function(parameter)
&.syntax--parameter {
color: @mono-1;
}
// self cls iota
&.syntax--support {
color: @hue-5;
}
// @entity.decorator
&.syntax--decorator:last-child {
color: @hue-2;
}
// label:
&.syntax--label {
text-decoration: underline;
}
// function method
&.syntax--function {
color: @hue-2;
}
// add
&.syntax--operator {
color: @hue-2;
// %>% <=>
&.syntax--symbolic {
color: @mono-1;
}
}
// String Class int rune list
&.syntax--type {
color: @hue-1;
}
// div span
&.syntax--tag {
color: @hue-5;
}
// href src alt
&.syntax--attribute {
color: @hue-6;
}
}
// () [] {} => @
.syntax--punctuation {
color: @mono-1;
// . -> :: []
&.syntax--accessor {
color: @mono-1;
}
}
// "string"
.syntax--string {
color: @hue-4;
// :immutable
&.syntax--immutable {
color: @hue-4;
}
// {placeholder} %().2f
&.syntax--part {
color: @hue-1;
}
// ${ }
&.syntax--interpolation {
color: @mono-1;
}
// /^reg[ex]?p/
&.syntax--regexp {
color: @hue-4;
// ^ $ \b ? + i
&.syntax--language {
color: @hue-3;
}
// <variable> \1
&.syntax--variable {
color: @hue-2;
}
// ( ) [^ ] (?= ) |
&.syntax--punctuation {
color: @hue-3;
}
}
}
// literal 4 1.3 true nil
.syntax--constant {
color: @hue-6;
// &lt; 'a'
&.syntax--character {
color: @hue-4;
// \" \' \g \.
&.syntax--escape {
color: @hue-4;
}
// \u2661 \n \t \W .
&.syntax--code {
color: @hue-1;
}
}
}
// text
.syntax--text {
color: @mono-1;
}
// __formatted__
.syntax--markup {
// # Heading
&.syntax--heading {
color: @hue-5;
}
// 1. * -
&.syntax--list.syntax--punctuation {
color: @hue-5;
}
// > quote
&.syntax--quote {
color: @mono-3;
font-style: italic;
}
// **bold**
&.syntax--bold {
color: @hue-6;
font-weight: bold;
}
// *italic*
&.syntax--italic {
color: @hue-3;
font-style: italic;
}
// __underline__
&.syntax--underline {
color: @hue-1;
text-decoration: underline;
}
// ~~strike~~
&.syntax--strike {
color: @hue-5;
}
// `raw`
&.syntax--raw {
color: @hue-4;
}
// url.com (path)
&.syntax--link {
color: @hue-1;
}
// [alt] ![alt]
&.syntax--alt {
color: @hue-2;
}
// {++ inserted ++}
&.syntax--inserted {
color: @hue-4;
.syntax--punctuation {
color: @hue-4;
}
}
// {== highlighted ==}
&.syntax--highlighted {
color: @hue-4;
.syntax--punctuation {
color: @hue-4;
}
}
// {-- deleted --}
&.syntax--deleted {
color: @hue-5;
.syntax--punctuation {
color: @hue-5;
}
}
// {~~ from~>to ~~}
&.syntax--changed {
color: @hue-3;
.syntax--punctuation {
color: @hue-3;
}
}
// {>> commented <<}
&.syntax--commented {
color: @mono-3;
.syntax--punctuation {
color: @mono-3;
}
}
}
// /* comment */
.syntax--comment {
color: @mono-3;
font-style: italic;
// @param TODO NOTE
&.syntax--caption {
color: lighten(@mono-3, 6);
font-weight: bold;
}
// variable function type
&.syntax--term {
color: lighten(@mono-3, 9);
}
// { } / .
&.syntax--punctuation {
color: @mono-3;
font-weight: normal;
}
}
// 0invalid
.syntax--invalid:not(.syntax--punctuation) {
// §illegal
&.syntax--illegal {
color: @syntax-illegal-fg !important;
background-color: @syntax-illegal-bg !important;
}
// obsolete()
&.syntax--deprecated {
color: @syntax-deprecated-fg !important;
background-color: @syntax-deprecated-bg !important;
}
}

View File

@ -1,12 +1,103 @@
.syntax--source.syntax--css {
// highlight properties/values if they are supported
.syntax--property-name,
.syntax--property-value {
color: @mono-2;
&.syntax--support {
color: @mono-1;
.syntax--entity {
// function()
&.syntax--function {
color: @mono-2;
// url rgb
&.syntax--support {
color: @hue-1;
}
}
// .class :pseudo-class attribute
&.syntax--selector {
color: @hue-6;
// div span
&.syntax--tag {
color: @hue-5;
}
// #id
&.syntax--id {
color: @hue-2;
}
}
// property: constant
&.syntax--property {
color: @mono-2;
// height position border
&.syntax--support {
color: @mono-1;
}
}
// --variable
&.syntax--variable {
color: @hue-5;
}
}
// property: constant
.syntax--constant {
color: @mono-2;
// flex solid bold
&.syntax--support {
color: @mono-1;
}
// 3px 4em
&.syntax--numeric {
color: @hue-6;
}
// screen print
&.syntax--media {
color: @hue-6;
}
// #b294bb blue red
&.syntax--color {
color: @hue-6;
}
// from to
&.syntax--offset {
color: @mono-1;
}
// [attribute=attribute-value]
&.syntax--attribute-value {
color: @hue-4;
}
}
.syntax--punctuation {
// . : ::
&.syntax--selector {
color: @hue-6;
// *
&.syntax--wildcard {
color: @hue-5;
}
// #
&.syntax--id {
color: @hue-2;
}
// []
&.syntax--attribute {
color: @mono-1;
}
}
}
}

View File

@ -6,17 +6,22 @@
@import "styles/editor.less";
// Languages
@import "styles/syntax/_base.less";
@import "styles/syntax/c.less";
@import "styles/syntax/coffee.less";
@import "styles/syntax-legacy/_base.less";
// @import "styles/syntax-legacy/c.less";
@import "styles/syntax-legacy/coffee.less";
@import "styles/syntax-legacy/css.less";
// @import "styles/syntax-legacy/go.less";
@import "styles/syntax-legacy/java.less";
// @import "styles/syntax-legacy/javascript.less";
@import "styles/syntax-legacy/markdown.less";
@import "styles/syntax-legacy/markup.less";
@import "styles/syntax-legacy/php.less";
// @import "styles/syntax-legacy/python.less";
// @import "styles/syntax-legacy/ruby.less";
@import "styles/syntax-legacy/scala.less";
@import "styles/syntax-legacy/typescript.less";
@import "styles/syntax/base.less";
@import "styles/syntax/css.less";
@import "styles/syntax/go.less";
@import "styles/syntax/java.less";
@import "styles/syntax/javascript.less";
@import "styles/syntax/markdown.less";
@import "styles/syntax/markup.less";
@import "styles/syntax/php.less";
@import "styles/syntax/python.less";
@import "styles/syntax/ruby.less";
@import "styles/syntax/scala.less";
@import "styles/syntax/typescript.less";
@import "styles/syntax/html.less";
@import "styles/syntax/js.less";

View File

@ -0,0 +1,63 @@
.syntax--source.syntax--css {
.syntax--punctuation {
&.syntax--separator,
&.syntax--terminator {
color: @syntax-text-color;
}
&.syntax--property-list.syntax--begin,
&.syntax--property-list.syntax--end {
color: @red;
}
&.syntax--section.syntax--function {
color: @cyan;
}
}
.syntax--entity.syntax--name {
color: @green;
}
.syntax--attribute-name.syntax--class,
.syntax--id {
color: @blue;
}
.syntax--pseudo-element,
.syntax--pseudo-class {
color: @orange;
}
.syntax--property-value {
color: @cyan;
}
.syntax--constant.syntax--numeric {
color: @cyan;
.syntax--unit {
color: @cyan;
}
}
.syntax--rgb-value {
color: @cyan;
}
.syntax--support.syntax--constant {
color: @cyan;
&.syntax--media {
color: @red;
}
}
.syntax--keyword.syntax--important {
color: @red;
}
}
// Less/Sass should have their own files,
// but for just a single override, here should be fine too
.syntax--source.syntax--less,
.syntax--source.syntax--scss {
.syntax--keyword.syntax--unit {
color: @cyan;
}
}

View File

@ -6,23 +6,19 @@
.syntax--support.syntax--class {
color: @green;
}
.syntax--entity {
&.syntax--name.syntax--type {
color: @yellow;
}
&.syntax--name {
color: @syntax-text-color;
&.syntax--function {
color: @blue;
}
}
&.syntax--name.syntax--tag {
color: @blue;
}
&.syntax--other.syntax--attribute-name {
color: @yellow;
}
@ -40,7 +36,7 @@
color: @green;
}
.syntax--keyword.syntax--control {
color: @orange;
color: @green;
}
.syntax--keyword.syntax--control.syntax--regexp {
color: @cyan;
@ -75,7 +71,13 @@
.syntax--support.syntax--constant {
color: @syntax-text-color;
}
.syntax--constant.syntax--numeric {
color: @syntax-text-color;
}
.syntax--storage {
color: @blue;
}
.syntax--storage.syntax--modifier {
color: @yellow;
}
@ -93,7 +95,7 @@
.syntax--meta.syntax--brace.syntax--curly {
color: @blue;
}
.syntax--string.syntax--quoted.syntax--template {
.syntax--embedded.syntax--source {
color: @syntax-text-color;
@ -102,14 +104,14 @@
}
}
}
&.syntax--embedded .syntax--entity.syntax--name.syntax--tag {
color: @blue;
}
.syntax--import {
.syntax--control {
color: @orange;
color: @yellow;
}
}
}

Some files were not shown because too many files have changed in this diff Show More