Skip to content

Commit

Permalink
chore(release): 1.0.0 [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
semantic-release-bot committed Jul 15, 2021
1 parent bd05213 commit 34eba0e
Show file tree
Hide file tree
Showing 13 changed files with 158 additions and 1 deletion.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 1.0.0 (2021-07-15)


### Bug Fixes

* add dependencies - use atom-community packages ([d9d7164](https://github.com/atom-community/atom-ide-code-format/commit/d9d7164db25df401bd76d80dc96f6254d57a54e0))
* adopt template - add build scripts ([1019c71](https://github.com/atom-community/atom-ide-code-format/commit/1019c71d454ea2a01446869ac4628b15834f33de))
* do not bundle rxjs-compat/bundles/rxjs-compat.umd.min.js ([933b58f](https://github.com/atom-community/atom-ide-code-format/commit/933b58fb298936eaabe4756612354a1e9d40ce27))
* eslint fix ([feef034](https://github.com/atom-community/atom-ide-code-format/commit/feef034e679201f68653066c367b04feb16c2d39))
* export package functions directly ([dd924fb](https://github.com/atom-community/atom-ide-code-format/commit/dd924fb939f8955c1dc3814cedc52d89e06af9a7))
* free _checkContentsAreSame ([669f20a](https://github.com/atom-community/atom-ide-code-format/commit/669f20a0a24578c50f4cceee0ab29e2412214653))
* free _getEditorEventStream ([72586af](https://github.com/atom-community/atom-ide-code-format/commit/72586af562a3e01ccc3ffe0c577c96e30ceef24c))
* more strict tsconfig ([df4ecdd](https://github.com/atom-community/atom-ide-code-format/commit/df4ecdd185976e606a94d2c30e5ceb0168189dd8))
* move config to config.json ([32260d5](https://github.com/atom-community/atom-ide-code-format/commit/32260d5622dfecc6a76a7a20478c0c4cf75e51cf))


### Features

* convert to Typescript ([0506e74](https://github.com/atom-community/atom-ide-code-format/commit/0506e743f6482493d87eb40449c24c43c4db155f))
2 changes: 2 additions & 0 deletions dist/main.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/main.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/spec/CodeFormatManager-spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
2 changes: 2 additions & 0 deletions dist/spec/runner.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const _default: import("atom").TestRunner;
export default _default;
4 changes: 4 additions & 0 deletions dist/spec/utils.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** Wait until a function returns true */
export declare function waitFor(fn: (...args: any[]) => boolean, timeout?: number): any;
/** Sleep for ms */
export declare function sleep(ms: any): Promise<unknown>;
52 changes: 52 additions & 0 deletions dist/src/CodeFormatManager.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import type { TextEditor, TextChange, Disposable } from "atom";
declare type AggregatedTextChange = {
changes: Array<TextChange>;
};
import type { TextEdit } from "@atom-ide-community/nuclide-commons-atom/text-edit";
import type { BusySignalService } from "atom-ide-base";
import type { FileCodeFormatProvider, OnSaveCodeFormatProvider, OnTypeCodeFormatProvider, RangeCodeFormatProvider } from "./types";
import { Range } from "atom";
import ProviderRegistry from "@atom-ide-community/nuclide-commons-atom/ProviderRegistry";
import UniversalDisposable from "@atom-ide-community/nuclide-commons/UniversalDisposable";
import { Observable } from "rxjs-compat/bundles/rxjs-compat.umd.min.js";
import type { Subscription } from "rxjs";
export declare const SAVE_TIMEOUT = 2500;
declare type FormatEvent = {
type: "command" | "save" | "new-save";
editor: TextEditor;
} | {
type: "type";
editor: TextEditor;
edit: AggregatedTextChange;
};
export default class CodeFormatManager {
_subscriptions: UniversalDisposable;
_rangeProviders: ProviderRegistry<RangeCodeFormatProvider>;
_fileProviders: ProviderRegistry<FileCodeFormatProvider>;
_onTypeProviders: ProviderRegistry<OnTypeCodeFormatProvider>;
_onSaveProviders: ProviderRegistry<OnSaveCodeFormatProvider>;
_busySignalService: BusySignalService | undefined | null;
constructor();
/**
* Subscribe to all formatting events (commands, saves, edits) and dispatch formatters as necessary. By handling all
* events in a central location, we ensure that no buffer runs into race conditions with simultaneous formatters.
*/
_subscribeToEvents(): Subscription;
_handleEvent(event: FormatEvent): Observable<unknown>;
_formatCodeInTextEditor(editor: TextEditor, range?: Range): Observable<Array<TextEdit>>;
_formatCodeOnTypeInTextEditor(editor: TextEditor, aggregatedEvent: AggregatedTextChange): Observable<Array<TextEdit>>;
_onWillSaveProvider(): {
priority: number;
timeout: number;
callback: (editor: TextEditor) => any;
};
_formatCodeOnSaveInTextEditor(editor: TextEditor): Observable<TextEdit>;
_reportBusy<T>(editor: TextEditor, promise: Promise<T>, revealTooltip?: boolean): Promise<T>;
addRangeProvider(provider: RangeCodeFormatProvider): Disposable;
addFileProvider(provider: FileCodeFormatProvider): Disposable;
addOnTypeProvider(provider: OnTypeCodeFormatProvider): Disposable;
addOnSaveProvider(provider: OnSaveCodeFormatProvider): Disposable;
consumeBusySignal(busySignalService: BusySignalService): Disposable;
dispose(): void;
}
export {};
3 changes: 3 additions & 0 deletions dist/src/config.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import type { TextEditor } from "atom";
export declare function getFormatOnSave(editor: TextEditor): boolean;
export declare function getFormatOnType(): boolean;
3 changes: 3 additions & 0 deletions dist/src/legacy-provider.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import type { Disposable } from "atom";
import type { CodeFormatProvider } from "./types";
export declare function consumeLegacyProvider(provider: CodeFormatProvider): Disposable;
12 changes: 12 additions & 0 deletions dist/src/main.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { Disposable } from "atom";
import type { BusySignalService } from "atom-ide-base";
import type { RangeCodeFormatProvider, FileCodeFormatProvider, OnTypeCodeFormatProvider, OnSaveCodeFormatProvider } from "./types";
export { default as config } from "./config.json";
export declare function activate(): void;
export declare function consumeRangeProvider(provider: RangeCodeFormatProvider): Disposable;
export declare function consumeFileProvider(provider: FileCodeFormatProvider): Disposable;
export declare function consumeOnTypeProvider(provider: OnTypeCodeFormatProvider): Disposable;
export declare function consumeOnSaveProvider(provider: OnSaveCodeFormatProvider): Disposable;
export declare function consumeBusySignal(busySignalService: BusySignalService): Disposable;
export declare function deactivate(): void;
export { consumeLegacyProvider } from "./legacy-provider";
57 changes: 57 additions & 0 deletions dist/src/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import type { TextEditor, Range, Point } from "atom";
import type { TextEdit } from "@atom-ide-community/nuclide-commons-atom/text-edit";
/**
* A brief overview of the different code formatting providers:
*
* == Range formatters == These accept a range to format and return a list of edits to apply. These will always be
* preferred over file formatters when a range is selected.
*
* == File formatters == These always return the result of formatting the entire file. To compensate, they can return a
* custom cursor position to avoid disruption. These will be preferred over range formatters for whole-file formatting.
*
* == onType formatters == These are run after every typing event in a selected editor.
*
* == onSave formatters == These are run whenever a selected editor is saved. If the global format-on-save option is
* enabled, then file/range formatters will be triggered on save (even if no save formatters are provided). Obviously,
* save formatters are preferred in this case.
*/
/**
* Formats the range specified, and returns a list of text edits to apply. Text edits must be non-overlapping and
* preferably in reverse-sorted order.
*/
export declare type RangeCodeFormatProvider = {
formatCode: (editor: TextEditor, range: Range) => Promise<Array<TextEdit>>;
priority: number;
readonly grammarScopes?: Array<string>;
};
/**
* Formats the range specified, but returns the entire file (along with the new cursor position). Useful for
* less-flexible providers like clang-format.
*/
export declare type FileCodeFormatProvider = {
formatEntireFile: (editor: TextEditor, range: Range) => Promise<{
newCursor?: number;
formatted: string;
} | undefined | null>;
priority: number;
readonly grammarScopes?: Array<string>;
};
/**
* Formats around the given position, and returns a list of text edits to apply, similar to `formatCode`. The provider
* determines the exact range to format based on what's at that position.
*
* This will automatically triggered after every typing event.
*/
export declare type OnTypeCodeFormatProvider = {
formatAtPosition: (editor: TextEditor, position: Point, triggerCharacter: string) => Promise<Array<TextEdit>>;
priority: number;
readonly grammarScopes?: Array<string>;
keepCursorPosition: boolean;
};
/** Formats files after save events. */
export declare type OnSaveCodeFormatProvider = {
formatOnSave: (editor: TextEditor) => Promise<Array<TextEdit>>;
priority: number;
readonly grammarScopes?: Array<string>;
};
export declare type CodeFormatProvider = RangeCodeFormatProvider | FileCodeFormatProvider | OnTypeCodeFormatProvider | OnSaveCodeFormatProvider;
1 change: 1 addition & 0 deletions dist/tsconfig.tsbuildinfo

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Code Formatting for Atom IDE",
"repository": "https://github.com/atom-community/atom-ide-code-format",
"main": "./dist/main.js",
"version": "0.0.0",
"version": "1.0.0",
"description": "Provides a code-formatting provider API",
"scripts": {
"format": "prettier --write .",
Expand Down

0 comments on commit 34eba0e

Please sign in to comment.