• This repository has been archived on 15/Dec/2022
  • Stars
    star
    152
  • Rank 244,685 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 8 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Native core components for Atom
Atom and all repositories under Atom will be archived on December 15, 2022. Learn more in our official announcement

Superstring

ci

Native library at the core of Atom's text editor.

Components:

Patch

This data structure represents a transformation from input to output text, and it's useful for combining changes that occur at different points in time and space.

Example:

const patch = new Patch

// At column 5, replace the string 'abc' with '1234':
patch.splice({row: 0, column: 5}, {row: 0, column: 3}, {row: 0, column: 4}, 'abc', '1234')

// Then at column 7, replace 3 characters with 4 characters:
patch.splice({row: 0, column: 7}, {row: 0, column: 3}, {row: 0, column: 4}, '34d', '5678')

// Retrieve the consolidated changes:
assert.deepEqual(patch.getChanges(), [
  {
    oldStart: {row: 0, column: 5},
    oldEnd: {row: 0, column: 9},
    oldText: 'abcd',
    newStart: {row: 0, column: 5},
    newEnd: {row: 0, column: 11},
    newText: '125678'
  }
])

MarkerIndex

This data structure is used to track logical locations in a text buffer as the contents of the buffer are changed.

Example:

const index = new MarkerIndex

// Associate a marker id with two ordered start and end points
index.insert(1, {row: 2, column: 5}, {row: 4, column: 10})

// Splice represents a change to the text file
// you pass it a starting point, then points representing the old and new extent
index.splice({row: 3, column: 5}, {row: 0, column: 0}, {row: 1, column: 0})

// The marker's end point was updated by the splice
assert.deepEqual(index.getEnd(1), {row: 5, column: 10})

API

insert (id, start, end)

Associates the given non-negative integer with a range represented by two {row: number, column: number} objects.

splice (start, oldExtent, newExtent)

Update the locations of all markers based on the description of a change to the text. The range of the replaced text is described by traversing from start by oldExtent. The range of the new text is described by traversing from start to newExtent.

Traversal means that beginning with the start location, we arrive at a new location by performing X line feeds and carriage returns and then walk forward Y columns, where X is the row of the given traversal extent and Y is its column. So basically start, oldExtent, and newExtent describe two ranges in the file, basically the spatial before and after effects of a change.

This method returns an object that describes what markers were invalidated by the change based on various invalidation strategies. If a marker is in a set for a given strategy, it was invalidated according to that strategy. The strategies are as follows:

  • touch Contains markers that the change touched in any way.
  • inside Contains markers that the change touched, but not markers with endpoints immediately adjacent to the change.
  • overlap Contains markers that had one or both of their endpoints surrounded by the change.
  • surround Contains markers that had both endpoints surrounded by the change.
setExclusive (markerId, boolean)

This method allows to control the behavior of a marker when splices start and/or end at the marker's endpoints.

By default, we consider markers to be inclusive: that is, splices exactly at the beginning of the marked range will be considered to begin inside the marker (meaning that the marker's start position will not move), and splices exactly at the end of the marked range will be considered to end inside the marker (meaning that the marker's end position will move).

Exclusive markers, on the other hand, exhibit a slightly different behavior: in fact, splices exactly at the beginning of the marked range will be considered to begin outside the marker (meaning that the marker's start position will move), and splices exactly at the end of the marked range will be considered to end outside the marker (meaning that the marker's end position will not move).

Please note that, independently of whether a marker is inclusive or exclusive, its end will always be moved when its start gets moved as a result of a splice.

isExclusive (markerId)

Returns whether the given marker id has been set to behave exclusively via setExclusive.

delete (markerId)

Removes the specified marker from the index.

getRange (markerId)

Returns the range for the given marker id, in the form of an object with start and end points.

getStart (markerId)

Returns a {row: number, column: number} object representing the start of the specified marker.

getEnd (markerId)

Returns a {row: number, column: number} object representing the end of the specified marker.

dump ()

Returns the current location of every marker in the index, represented as an object mapping marker ids to range objects. For example:

{
  '1': {start: {row: 2, column: 5}, end: {row: 5, column: 10}},
  '2': {start: {row: 4, column: 10}, end: {row: 6, column: 3}}
}
findIntersecting (start, end = start)

Returns a set with the ids of all markers intersecting the specified point range.

findContaining (start, end = start)

Returns a set with the ids of all markers intersecting the specified point range.

findContainedIn (start, end)

Returns a set with the ids of all markers contained in the specified point range.

findStartingIn (start, end)

Returns a set with the ids of all markers starting in the specified point range.

findEndingIn (start, end)

Returns a set with the ids of all markers ending in the specified point range.

findStartingAt (position)

Returns a set with the ids of all markers starting at the specified point.

findEndingAt (position)

Returns a set with the ids of all markers ending at the specified point.

findBoundariesIn (start, end)

A boundary is a position in the index where a marker starts or ends. Multiple markers starting and/or ending at the same position describe only one boundary. This method returns an object containing all the boundaries in the specified point range, and an array of marker ids that overlap the specified start position. For example:

{
  containingStart: [1, 2, 3, 4],
  boundaries: [
    {position: {row: 0, column: 1}, starting: new Set([5, 6]), ending: new Set()},
    {position: {row: 1, column: 0}, starting: new Set(), ending: new Set([5])}
    {position: {row: 2, column: 0}, starting: new Set(), ending: new Set([6])}
  ]
}

More Repositories

1

atom

:atom: The hackable text editor
JavaScript
59,608
star
2

teletype

Share your workspace with team members and collaborate on code in real time in Atom
JavaScript
2,406
star
3

vim-mode

Next generation vim support for atom
CoffeeScript
1,722
star
4

node-keytar

Native Password Node Module
C++
1,365
star
5

apm

Atom Package Manager
CoffeeScript
1,263
star
6

markdown-preview

📝 Markdown preview in Atom
JavaScript
1,235
star
7

github

:octocat: Git and GitHub integration for Atom
JavaScript
1,114
star
8

autocomplete-plus

View and insert possible completions in the editor while typing
JavaScript
960
star
9

teletype-crdt

String-wise sequence CRDT powering peer-to-peer collaborative editing in Teletype for Atom.
JavaScript
751
star
10

flight-manual.atom.io

📖 Documentation for Atom, generated by nanoc, hosted by GitHub Pages
SCSS
639
star
11

tree-view

🌳 Explore and open project files in Atom
CoffeeScript
564
star
12

etch

Builds components using a simple and explicit API around virtual-dom
JavaScript
555
star
13

highlights

Syntax highlighter
CoffeeScript
529
star
14

one-dark-syntax

Atom One dark syntax theme
CSS
447
star
15

atom-languageclient

Language Server Protocol support for Atom (the basis of Atom-IDE)
TypeScript
389
star
16

ide-typescript

TypeScript and Javascript language support for Atom-IDE
JavaScript
368
star
17

fuzzaldrin

Fuzzy filtering and string scoring
CoffeeScript
317
star
18

node-spellchecker

SpellChecker Node Module
C++
294
star
19

fuzzy-finder

Find and open files quickly
JavaScript
277
star
20

settings-view

🔧 Edit Atom settings
CoffeeScript
269
star
21

one-dark-ui

Atom One dark UI theme
CSS
265
star
22

ide-php

PHP language support for Atom-IDE
JavaScript
264
star
23

find-and-replace

Find and replace in a single buffer and in the project
JavaScript
244
star
24

ide-java

Java language support for Atom-IDE
JavaScript
227
star
25

electron-link

A module to bundle your electron app into a single file that can be used for V8 snapshots.
JavaScript
218
star
26

teletype-client

Editor-agnostic library managing client interaction for peer-to-peer collaborative editing in Teletype for Atom
JavaScript
210
star
27

spell-check

Spell check Atom package
JavaScript
206
star
28

snippets

Atom snippets package
JavaScript
200
star
29

watcher

Atom Filesystem Watcher
C++
200
star
30

language-javascript

JavaScript language package for Atom
CoffeeScript
196
star
31

language-python

Python package for Atom
CoffeeScript
188
star
32

sort-lines

An Atom package to sort lines of text
JavaScript
173
star
33

git-utils

Git Node Module
JavaScript
167
star
34

symbols-view

Jump to symbols in Atom
JavaScript
164
star
35

atom.io

🌐 A place for feedback on the atom.io website and package API
159
star
36

welcome

Welcome editor thats shows on first run
JavaScript
158
star
37

text-buffer

Atom's underlying text buffer
JavaScript
144
star
38

bracket-matcher

Jump to brackets
JavaScript
142
star
39

metrics

Help improve Atom by sending usage statistics, exceptions and deprecations to the team.
JavaScript
139
star
40

node-oniguruma

Oniguruma Node Module
JavaScript
121
star
41

language-php

PHP package for Atom
CoffeeScript
120
star
42

teletype-server

Server-side application that facilitates peer discovery for collaborative editing sessions in Teletype
JavaScript
118
star
43

language-c

C support in Atom
CoffeeScript
117
star
44

command-palette

Command Palette in Atom
JavaScript
117
star
45

styleguide

A package to exercise all the UI components.
JavaScript
115
star
46

fs-plus

node's fs module with some helpful additions
CoffeeScript
108
star
47

language-html

HTML package for Atom
CoffeeScript
108
star
48

tabs

Tabs in Atom
CoffeeScript
107
star
49

language-go

Go language package for Atom
CoffeeScript
106
star
50

atom-keymap

Atom's selector-based keymap system
CoffeeScript
105
star
51

atom-dark-ui

The default dark ui theme for Atom
CSS
103
star
52

git-diff

Diff markers in Atom's gutter
JavaScript
102
star
53

language-ruby

Ruby package for Atom
Ruby
102
star
54

status-bar

Status bar for Atom
CoffeeScript
101
star
55

language-gfm

GitHub Flavored Markdown in Atom
CoffeeScript
101
star
56

eon

Real-Time Conflict-Free Version Control System
101
star
57

event-kit

Simple library for implementing and consuming evented APIs
JavaScript
96
star
58

whitespace

Atom whitespace package
JavaScript
94
star
59

node-pathwatcher

Path Watcher Node Module
CoffeeScript
94
star
60

open-on-github

Atom package for opening files on GitHub.com
JavaScript
94
star
61

package-generator

Package to generate new packages
JavaScript
91
star
62

first-mate

TextMate helpers
JavaScript
89
star
63

season

CSON Node Module
CoffeeScript
85
star
64

ci

Build your Atom packages
PowerShell
82
star
65

language-todo

TODO highlighting package for Atom
CoffeeScript
81
star
66

toggle-quotes

An Atom package to toggle between single and double quotes
JavaScript
77
star
67

one-light-ui

Atom One light UI theme
CSS
75
star
68

solarized-dark-syntax

Atom syntax theme using the dark Solarized colors
CSS
74
star
69

notifications

User notifications
CoffeeScript
74
star
70

autocomplete-emojis

autocomplete+ emoji autocompletion
CoffeeScript
74
star
71

autocomplete-css

CSS property name and value completions
CoffeeScript
69
star
72

ascii-art

Convert selected text to ascii art banner
JavaScript
68
star
73

one-light-syntax

Atom One light syntax theme
CSS
68
star
74

atom-ui

Atom's UI library
CSS
67
star
75

autosave

Autosaves buffers when they lose focus
JavaScript
64
star
76

language-sass

Sass package for Atom
CoffeeScript
63
star
77

atom-space-pen-views

Atom SpacePen views that previously lived in core.
CoffeeScript
63
star
78

language-java

Java package for Atom
CoffeeScript
62
star
79

language-csharp

C# language support for Atom
Python
62
star
80

keyboard-layout

Node module to read and observe the current keyboard layout
C++
61
star
81

autocomplete-html

HTML tag and attribute completions
JavaScript
60
star
82

underscore-plus

Underscore with some extensions
CoffeeScript
60
star
83

language-css

CSS package for Atom
CoffeeScript
59
star
84

atomdoc

Atom's documentation parser for JavaScript / CoffeeScript
JavaScript
58
star
85

language-coffee-script

CoffeeScript support in Atom
CoffeeScript
58
star
86

atom-dark-syntax

Atom Dark Syntax theme
CSS
57
star
87

ide-csharp

C# language support for Atom-IDE
JavaScript
56
star
88

theorist

A reactive model toolkit for CoffeeScript
CoffeeScript
51
star
89

language-clojure

Clojure package for Atom
Clojure
49
star
90

bookmarks

Bookmark editor lines in Atom
JavaScript
49
star
91

language-ruby-on-rails

Ruby on Rails package for Atom
CoffeeScript
48
star
92

language-mustache

Mustache package for Atom
CoffeeScript
47
star
93

template-syntax

A template atom syntax theme to build from
Less
46
star
94

autocomplete-snippets

Adds snippets to autocomplete+ suggestions
JavaScript
46
star
95

keybinding-resolver

Shows what a keybinding resolves to
JavaScript
44
star
96

editor-stats

Graph your keyboard activity
CoffeeScript
44
star
97

image-view

View images in an Atom editor
JavaScript
44
star
98

base16-tomorrow-dark-theme

Base16 Theme for Atom
CSS
41
star
99

pr-changelog

Generate a PR changelog between two refs
JavaScript
40
star
100

wrap-guide

Don't cross the line
CoffeeScript
40
star