Skip to content

Commit

Permalink
Update dependencies & flow definitions (#441)
Browse files Browse the repository at this point in the history
  • Loading branch information
GauthierPLM authored Nov 16, 2018
1 parent 2ae858e commit e0ab7a6
Show file tree
Hide file tree
Showing 45 changed files with 5,268 additions and 5,046 deletions.
97 changes: 79 additions & 18 deletions flow-libs/atom.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ declare class atom$CompositeDisposable {
clear(): void,
}

type atom$ConfigParams = {
saveCallback?: Object => void,
mainSource?: string,
projectHomeSchema?: atom$ConfigSchema,
};

type atom$ConfigType =
'boolean' | 'string' | 'integer' | 'number' |
'array' | 'object' | 'color' | 'any';
Expand All @@ -149,6 +155,9 @@ type atom$ConfigSchema = {
};

declare class atom$Config {
defaultSettings: Object,
settings: Object,

// Config Subscription
observe(
keyPath: string,
Expand Down Expand Up @@ -198,6 +207,7 @@ declare class atom$Config {
getUserConfigPath(): string,

// Undocumented Methods
constructor(params?: atom$ConfigParams): atom$Config,
getRawValue(keyPath: ?string, options: {excludeSources?: string, sources?: string}): mixed,
getSchema(keyPath: string): atom$ConfigSchema,
save(): void,
Expand All @@ -207,9 +217,16 @@ declare class atom$Config {
schema: atom$ConfigSchema,
): void,
removeAtKeyPath(keyPath: ?string, value: ?mixed): mixed,

// Used by nuclide-config to set the initial settings from disk
resetUserSettings(newSettings: Object, options?: {source?: string}): void,
}

declare class atom$Cursor {
// Cursor Marker
marker: atom$Marker;
editor: atom$TextEditor;

// Event Subscription
onDidChangePosition(
callback: (event: {
Expand All @@ -229,6 +246,8 @@ declare class atom$Cursor {

// Cursor Position Details
// Moving the Cursor
moveUp(rowCount: number, {moveToEndOfSelection?: boolean}): void,
moveDown(rowCount: number, {moveToEndOfSelection?: boolean}): void,

// Local Positions and Ranges
getCurrentWordBufferRange(options?: {wordRegex: RegExp}): atom$Range,
Expand Down Expand Up @@ -259,6 +278,7 @@ declare class atom$DisplayMarkerLayer {
markBufferRange(range: atom$Range | atom$RangeLike, options?: MarkerOptions): atom$Marker,
findMarkers(options: MarkerOptions): Array<atom$Marker>,
getMarkers(): Array<atom$Marker>,
onDidUpdate(callback: () => mixed): IDisposable
}

declare class atom$LayerDecoration {
Expand Down Expand Up @@ -293,7 +313,7 @@ declare class atom$Gutter {
destroy(): void,
decorateMarker(
marker: atom$Marker,
options?: {'class'?: string, item?: Object | HTMLElement},
options?: {type?: string, 'class'?: string, item?: Object | HTMLElement},
): atom$Decoration,
show(): void,
hide(): void,
Expand Down Expand Up @@ -323,6 +343,7 @@ declare class atom$Marker {
isValid(): boolean,
isDestroyed(): boolean,
onDidDestroy(callback: () => mixed): IDisposable,
getScreenRange(): atom$Range,
setBufferRange(
range: atom$RangeLike,
properties?: {reversed: boolean},
Expand Down Expand Up @@ -373,6 +394,7 @@ declare class atom$PackageManager {
getActivePackage(name: string): ?atom$Package,
getActivePackages(): Array<atom$Package>,
isPackageActive(name: string): boolean,
hasActivatedInitialPackages(): boolean,

// Activating and deactivating packages
activatePackage(name: string): Promise<atom$Package>,
Expand Down Expand Up @@ -440,6 +462,9 @@ declare class atom$applicationDelegate {
devMode?: boolean,
safeMode?: boolean,
}): void,

// Used by nuclide-config to replicate atom.config saveCallback
setUserSettings(config: atom$Config, configFilePath: string): Promise<mixed>;
}

type atom$PaneParams = {
Expand All @@ -465,7 +490,7 @@ declare class atom$Pane {
activateItem(item: Object): ?Object,
activateItemAtIndex(index: number): void,
moveItemToPane(item: Object, pane: atom$Pane, index: number): void,
destroyItem(item: Object, force?: boolean): boolean | Promise<boolean>,
destroyItem(item: Object, force?: boolean): Promise<boolean>,
itemForURI(uri: string): Object,

// Event subscriptions.
Expand Down Expand Up @@ -500,6 +525,7 @@ declare class atom$Pane {
setPendingItem(item: atom$PaneItem): void,
clearPendingItem(): void,
getFlexScale(): number,
getElement(): HTMLElement,
getParent(): Object,
removeItem(item: Object, moved: ?boolean): void,
setActiveItem(item: Object): Object,
Expand Down Expand Up @@ -775,6 +801,9 @@ type DecorateMarkerParams = {
type: 'block',
item: HTMLElement,
position?: 'before' | 'after', // Defaults to 'before' when unspecified.
} | {
type: 'line-number',
class?: string,
};

type ChangeCursorPositionEvent = {
Expand Down Expand Up @@ -811,6 +840,8 @@ declare class atom$TextEditor extends atom$Model {
onDidStopChanging(callback: () => mixed): IDisposable,
onDidChangeCursorPosition(callback: (event: ChangeCursorPositionEvent) => mixed):
IDisposable,
onDidAddCursor(callback: (cursor: atom$Cursor) => mixed): IDisposable;
onDidRemoveCursor(callback: (cursor: atom$Cursor) => mixed): IDisposable;
onDidDestroy(callback: () => mixed): IDisposable,
onDidSave(callback: (event: {path: string}) => mixed): IDisposable,
getBuffer(): atom$TextBuffer,
Expand Down Expand Up @@ -853,6 +884,7 @@ declare class atom$TextEditor extends atom$Model {
getText(): string,
getTextInBufferRange(range: atom$RangeLike): string,
getLineCount(): number,
getScreenLineCount(): number,
getLastScreenRow(): number,

// Mutating Text
Expand Down Expand Up @@ -1105,6 +1137,7 @@ declare class atom$TextEditorComponent {

setScrollLeft(scrollLeft: number): void,
getScrollLeft(): number,
updateSync(useScheduler?: boolean): void,
}

/**
Expand Down Expand Up @@ -1235,11 +1268,22 @@ type AddTextEditorEvent = {
index: number,
};

type atom$WorkspaceOpenOptions = {
activatePane?: ?boolean,
activateItem?: ?boolean,
initialLine?: ?number,
initialColumn?: ?number,
pending?: ?boolean,
split?: ?string,
searchAllPanes?: ?boolean,
location?: atom$PaneLocation,
}

declare class atom$Workspace {
// Event Subscription
observePanes(cb: (pane: atom$Pane) => void): IDisposable,
observeTextEditors(callback: (editor: atom$TextEditor) => mixed): IDisposable,
observeActiveTextEditor(callback: (editor: atom$TextEditor) => mixed): IDisposable,
observeActiveTextEditor(callback: (editor: ?atom$TextEditor) => mixed): IDisposable,
onDidAddTextEditor(callback: (event: AddTextEditorEvent) => mixed): IDisposable,
onDidChangeActivePaneItem(callback: (item: mixed) => mixed): IDisposable,
onDidDestroyPaneItem(callback: (event: DestroyPaneItemEvent) => mixed): IDisposable,
Expand All @@ -1257,14 +1301,7 @@ declare class atom$Workspace {
// Opening
open(
uri?: string,
options?: {
activatePane?: ?boolean,
initialLine?: ?number,
initialColumn?: ?number,
pending?: ?boolean,
split?: ?string,
searchAllPanes?: ?boolean,
}
options?: atom$WorkspaceOpenOptions,
): Promise<atom$TextEditor>,
openURIInPane(
uri?: string,
Expand All @@ -1278,7 +1315,7 @@ declare class atom$Workspace {
): Promise<atom$TextEditor>,
isTextEditor(item: ?mixed): boolean,
/* Optional method because this was added post-1.0. */
buildTextEditor: ((params: atom$TextEditorParams) => atom$TextEditor),
buildTextEditor: ((params: ?atom$TextEditorParams) => atom$TextEditor),
/* Optional method because this was added in 1.9.0 */
handleGrammarUsed?: (grammar: atom$Grammar) => void,
reopenItem(): Promise<?atom$TextEditor>,
Expand All @@ -1293,8 +1330,10 @@ declare class atom$Workspace {
// Pane Items
getPaneItems(): Array<Object>,
getActivePaneItem(): ?Object,
getActivePaneContainer(): atom$PaneContainer,
getTextEditors(): Array<atom$TextEditor>,
getActiveTextEditor(): ?atom$TextEditor,
createItemForURI(uri: string, options: atom$WorkspaceOpenOptions): atom$PaneItem,

// Panes
getPanes(): Array<atom$Pane>,
Expand All @@ -1303,6 +1342,7 @@ declare class atom$Workspace {
activatePreviousPane(): boolean,
paneForURI(uri: string): atom$Pane,
paneForItem(item: mixed): ?atom$Pane,
paneContainers: {[location: atom$PaneLocation]: atom$AbstractPaneContainer},

// Panels
panelContainers: {[location: string]: atom$PanelContainer},
Expand Down Expand Up @@ -1565,6 +1605,13 @@ declare class atom$Grammar {
name: string,
scopeName: string,
tokenizeLines(text: string): Array<Array<atom$GrammarToken>>,
tokenizeLine(line: string, ruleStack: mixed, firstLine: boolean): {
line: string,
tags: Array<number>,
// Dynamic property: invoking it will incur additional overhead
tokens: Array<atom$GrammarToken>,
ruleStack: mixed
},
}

type atom$GrammarToken = {
Expand All @@ -1584,6 +1631,10 @@ declare class atom$GrammarRegistry {
autoAssignLanguageMode(buffer: atom$TextBuffer): void,
assignLanguageMode(buffer: atom$TextBuffer, languageId: string): void,

// Extended
getGrammarScore(grammar: atom$Grammar, filePath: string, contents?: string): number,
forEachGrammar(callback: (grammar: atom$Grammar) => mixed): void,

// Private API
clear(): IDisposable,
}
Expand Down Expand Up @@ -1847,6 +1898,7 @@ declare class atom$TextBuffer {
getLastRow(): number,
getRange(): atom$Range,
rangeForRow(row: number, includeNewLine?: boolean): atom$Range,
getLength(): number,

// Position/Index mapping
characterIndexForPosition(position: atom$PointLike): number,
Expand Down Expand Up @@ -1997,11 +2049,21 @@ type AtomGlobal = {
getCurrentWindow: void,

// Messaging the User
confirm(options: {
buttons?: Array<string> | {[buttonName: string]: () => mixed},
detailedMessage?: string,
message: string,
}): ?number,
+confirm:
& ((
{
message: string,
detail?: string,
buttons?: Array<string>,
},
(number) => void,
) => void)
// The synchronous form. You really shouldn't use this.
& (({
message: string,
detailedMessage?: string,
buttons?: Array<string> | {[buttonName: string]: () => mixed},
}) => ?number),

open(params: {
pathsToOpen?: Array<string>,
Expand Down Expand Up @@ -2043,7 +2105,6 @@ declare class atom$Repository {
getType: () => string,
getPath: () => string,
getWorkingDirectory: () => string,
getProjectDirectory: () => string,
isProjectAtRoot: () => boolean,
relativize: (aPath: string) => string,
getOriginURL: (aPath: ?string) => ?string,
Expand Down
Loading

0 comments on commit e0ab7a6

Please sign in to comment.