Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Combine icon & kind in Outline View into a unified styleable property #1182

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions flow-libs/atom.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ type atom$Octicon = 'alert' | 'alignment-align' | 'alignment-aligned-to' | 'alig
'trashcan' | 'triangle-down' | 'triangle-left' | 'triangle-right' | 'triangle-up' | 'unfold' |
'unmute' | 'unverified' | 'verified' | 'versions' | 'watch' | 'x' | 'zap';

type atom$OcticonsPrivate =
'type-array' | 'type-boolean' | 'type-class' | 'type-constant' | 'type-constructor' | 'type-enum' |
'type-field' | 'type-file' | 'type-function' | 'type-interface' | 'type-method' | 'type-module' |
'type-namespace' | 'type-number' | 'type-package' | 'type-property' | 'type-string' | 'type-variable';

declare class atom$Model {
destroy(): void,
isDestroyed(): boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,7 @@ class OutlineTree extends React.PureComponent {
}
};

const classNames = ['list-nested-item'];
if (outline.kind) {
classNames.push(`kind-${outline.kind}`);
}
const classes = classnames(classNames, {
const classes = classnames('list-nested-item', {
selected: outline.highlighted,
});
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ function treeToUiTree(
const shortName = nameOnly && outlineTree.representativeName != null;
return {
icon: nameOnly ? undefined : outlineTree.icon,
kind: nameOnly ? undefined : outlineTree.kind,
plainText: shortName
? outlineTree.representativeName
: outlineTree.plainText,
Expand Down
5 changes: 2 additions & 3 deletions modules/atom-ide-ui/pkg/atom-ide-outline-view/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ import {createOutlines} from './createOutlines';
import {Observable} from 'rxjs';

import type {TokenizedText} from 'nuclide-commons/tokenized-text-rpc-types';
import type {Outline, OutlineTreeKind} from './rpc-types';
import type {Outline} from './rpc-types';

export type OutlineTreeForUi = {
icon?: string, // from atom$Octicon, but we use string for convenience of remoting
kind?: OutlineTreeKind, // kind you can pass to the UI for theming
icon?: string, // from atom$Octicon | atom$OcticonPrivate - we use string for remoting
plainText?: string,
tokenizedText?: TokenizedText,

Expand Down
24 changes: 1 addition & 23 deletions modules/atom-ide-ui/pkg/atom-ide-outline-view/lib/rpc-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
import type {TokenizedText} from 'nuclide-commons/tokenized-text-rpc-types';

export type OutlineTree = {
icon?: string, // from atom$Octicon (that type's not allowed over rpc so we use string)
kind?: OutlineTreeKind, // kind you can pass to the UI for theming
icon?: string, // from atom$Octicon | atom$OcticonsPrivate (types not allowed over rpc so we use string)

// Must be one or the other. If both are present, tokenizedText is preferred.
plainText?: string,
Expand All @@ -28,24 +27,3 @@ export type OutlineTree = {
export type Outline = {
outlineTrees: Array<OutlineTree>,
};

// Kind of outline tree - matches the names from the Language Server Protocol v2.
export type OutlineTreeKind =
| 'file'
| 'module'
| 'namespace'
| 'package'
| 'class'
| 'method'
| 'property'
| 'field'
| 'constructor'
| 'enum'
| 'interface'
| 'function'
| 'variable'
| 'constant'
| 'string'
| 'number'
| 'boolean'
| 'array';