Skip to content

Commit 480113d

Browse files
authored
Merge pull request #111 from atom-community/config-json
2 parents f68e826 + 6beba63 commit 480113d

File tree

5 files changed

+48
-41
lines changed

5 files changed

+48
-41
lines changed

lib/config.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"showDataTipOnCursorMove": {
3+
"title": "Show datatip automatically on 'cursor' stay",
4+
"description": "If set to true, the data tip is shown as soon as you move your cursor stays on a word. Otherwise you will have to activate it via keypress.",
5+
"type": "boolean",
6+
"default": false
7+
},
8+
"showDataTipOnMouseMove": {
9+
"description": "If set to true, the data tip is shown as soon as mouse hovers on a word.",
10+
"title": "Show datatip automatically on 'mouse' hover",
11+
"type": "boolean",
12+
"default": true
13+
},
14+
"hoverTime": {
15+
"title": "Hover/Stay Time",
16+
"description": "The time that the mouse/cursor should hover/stay to show a datatip. Also specifies the time that the datatip is still shown when the mouse/cursor moves [ms].",
17+
"type": "number",
18+
"default": 80
19+
},
20+
"glowOnHover": {
21+
"title": "Glow on hover",
22+
"description": "Should the datatip glow when you hover on it?",
23+
"type": "boolean",
24+
"default": true
25+
}
26+
}

lib/datatip-manager.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
// @ts-check
2-
3-
import { CompositeDisposable, Disposable, Range, Point, TextEditor, TextEditorElement, CommandEvent, CursorPositionChangedEvent } from "atom"
1+
import {
2+
CompositeDisposable,
3+
Disposable,
4+
Range,
5+
Point,
6+
TextEditor,
7+
TextEditorElement,
8+
CommandEvent,
9+
CursorPositionChangedEvent,
10+
} from "atom"
411
import type { Datatip, DatatipProvider } from "atom-ide-base"
512
import { ViewContainer } from "atom-ide-base/commons-ui/float-pane/ViewContainer"
613
import { ProviderRegistry } from "atom-ide-base/commons-atom/ProviderRegistry"
@@ -49,7 +56,7 @@ export class DataTipManager {
4956
/**
5057
* config flag denoting if the data tip should be shown when moving the mouse cursor around
5158
*/
52-
showDataTipOnMouseMove = false
59+
showDataTipOnMouseMove = true
5360

5461
/**
5562
* holds the range of the current data tip to prevent unnecessary show/hide calls
@@ -328,10 +335,7 @@ export class DataTipManager {
328335
* @param evt the original event triggering this data tip evaluation
329336
* @return a promise object to track the asynchronous operation
330337
*/
331-
async showDataTip(
332-
editor: TextEditor,
333-
position: Point,
334-
): Promise<void> {
338+
async showDataTip(editor: TextEditor, position: Point): Promise<void> {
335339
try {
336340
let datatip: Datatip | null = null
337341
for (const provider of this.providerRegistry.getAllProvidersForEditor(editor)) {
@@ -424,7 +428,12 @@ export class DataTipManager {
424428
* @param view the data tip component to display
425429
* @return a composite object to release references at a later stage
426430
*/
427-
mountDataTipWithMarker(editor: TextEditor, range: Range, position: Point, view: ViewContainer): CompositeDisposable | null {
431+
mountDataTipWithMarker(
432+
editor: TextEditor,
433+
range: Range,
434+
position: Point,
435+
view: ViewContainer
436+
): CompositeDisposable | null {
428437
// TODO do we need this?
429438
if (!view.element) {
430439
// if the element is not created return right away

lib/main.ts

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// @ts-check
2-
31
import { CompositeDisposable } from "atom"
42
import { DataTipManager } from "./datatip-manager"
53
import type { DatatipService } from "atom-ide-base"
64

5+
export { default as config } from "./config.json"
6+
77
/**
88
* [subscriptions description]
99
*/
@@ -54,32 +54,3 @@ export function deactivate() {
5454
export function provideDatatipService(): DatatipService {
5555
return datatipManager!.datatipService
5656
}
57-
58-
export const config = {
59-
showDataTipOnCursorMove: {
60-
title: 'Show datatip automatically on "cursor" stay',
61-
description:
62-
"If set to true, the data tip is shown as soon as you move your cursor stays on a word. Otherwise you will have to activate it via keypress.",
63-
type: "boolean",
64-
default: true,
65-
},
66-
showDataTipOnMouseMove: {
67-
title: 'Show datatip automatically on "mouse" hover',
68-
description: "If set to true, the data tip is shown as soon as mouse hovers on a word.",
69-
type: "boolean",
70-
default: false,
71-
},
72-
hoverTime: {
73-
title: "Hover/Stay Time",
74-
description:
75-
"The time that the mouse/cursor should hover/stay to show a datatip. Also specifies the time that the datatip is still shown when the mouse/cursor moves [ms].",
76-
type: "number",
77-
default: 80,
78-
},
79-
glowOnHover: {
80-
title: "Glow on hover",
81-
description: "Should the datatip glow when you hover on it?",
82-
type: "boolean",
83-
default: true,
84-
},
85-
}

lib/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"target": "ES2018",
2323
"allowJs": true,
2424
"esModuleInterop": true,
25+
"resolveJsonModule": true,
2526
"module": "commonjs",
2627
"moduleResolution": "node",
2728
"importHelpers": false,

rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createPlugins } from "rollup-plugin-atomic"
22

3-
const plugins = createPlugins([["ts", { tsconfig: "./lib/tsconfig.json" }, true], "js"])
3+
const plugins = createPlugins([["ts", { tsconfig: "./lib/tsconfig.json" }, true], "js", "json"])
44

55
export default [
66
{

0 commit comments

Comments
 (0)