Skip to content
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
31 changes: 30 additions & 1 deletion lib/tree-view-open-files-pane-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,36 @@ class TreeViewOpenFilesPaneView
title = item.getLongTitle()

if entry = @entryForItem(item)
$(entry.element).find('.name').text title
$(entry.element).find('.name').text(title)

atom.config.observe 'tree-view-open-files.filePath', (filePath) =>
if filePath
if itemPath = item.getPath?()
titlePathElement = document.createElement('span')
titlePathElement.setAttribute('class', 'file-path')

projectDirElement = document.createElement('span')
projectDirElement.setAttribute('class', 'project-dir-name')
titlePathElement.textContent = ' <- '

for rootDir in atom.project.rootDirectories
if itemPath.indexOf(rootDir.path) > -1
itemPath = itemPath.replace(rootDir.path, '')
if atom.project.rootDirectories.length > 1
projectName = rootDir.path.split('/').slice(-1)[0]
else
projectName = '...'


projectDirElement.textContent = projectName
itemPathElement = document.createElement('span')
itemPathElement.textContent = itemPath
titlePathElement.appendChild(projectDirElement)
titlePathElement.appendChild(itemPathElement)

$(entry.element).find('.name').append titlePathElement
else
$(entry.element).find('.name').find('.file-path').remove()

updateModifiedState: (item, modified) ->
entry = @entryForItem(item)
Expand Down
3 changes: 3 additions & 0 deletions lib/tree-view-open-files-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class TreeViewOpenFilesView
@configSub = atom.config.observe 'tree-view-open-files.maxHeight', (maxHeight) =>
@element.style.maxHeight = if maxHeight > 0 then "#{maxHeight}px" else 'none'

@configSub = atom.config.observe 'tree-view-open-files.overflow', (overflow) =>
@element.style.overflow = if overflow then "visible" else 'auto'

addTabGroup: (pane) ->
group = new TreeViewOpenFilesPaneView
group.setPane pane
Expand Down
10 changes: 10 additions & 0 deletions lib/tree-view-open-files.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ module.exports =
min: 0
description: 'Maximum height of the list before scrolling is required. Set to 0 to disable scrolling.'

overflow:
type: 'boolean'
default: true
description: 'If checked list will be expanded with opening files (overflow: visible)'

filePath:
type: 'boolean'
default: true
description: 'Show file paths after file name'

activate: (state) ->
requirePackages('tree-view').then ([treeView]) =>
@treeViewOpenFilesView = new TreeViewOpenFilesView
Expand Down
66 changes: 57 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,65 @@
{
"name": "tree-view-open-files",
"main": "./lib/tree-view-open-files",
"version": "0.3.0",
"description": "Show open files in a list above the tree view.",
"repository": "https://github.com/postcasio/tree-view-open-files",
"license": "MIT",
"engines": {
"atom": ">=1.1.0"
"_args": [
[
{
"raw": "/tmp/d-116928-7039-k171f1/package.tgz",
"scope": null,
"escapedName": null,
"name": null,
"rawSpec": "/tmp/d-116928-7039-k171f1/package.tgz",
"spec": "/tmp/d-116928-7039-k171f1/package.tgz",
"type": "local"
},
"/tmp/apm-install-dir-116928-7039-7s29xr"
]
],
"_from": "../d-116928-7039-k171f1/package.tgz",
"_id": "[email protected]",
"_inCache": true,
"_installable": true,
"_location": "/tree-view-open-files",
"_phantomChildren": {},
"_requested": {
"raw": "/tmp/d-116928-7039-k171f1/package.tgz",
"scope": null,
"escapedName": null,
"name": null,
"rawSpec": "/tmp/d-116928-7039-k171f1/package.tgz",
"spec": "/tmp/d-116928-7039-k171f1/package.tgz",
"type": "local"
},
"_requiredBy": [
"#USER"
],
"_resolved": "file:../d-116928-7039-k171f1/package.tgz",
"_shasum": "8cca29fd0bfa05c2a4c593ce0b86377220c2e514",
"_shrinkwrap": null,
"_spec": "/tmp/d-116928-7039-k171f1/package.tgz",
"_where": "/tmp/apm-install-dir-116928-7039-7s29xr",
"bugs": {
"url": "https://github.com/postcasio/tree-view-open-files/issues"
},
"dependencies": {
"atom-utils": ">=0.7.4",
"event-kit": "^0.8.0",
"lodash": "^2.4.1",
"space-pen": "^3.8.0"
}
},
"description": "Show open files in a list above the tree view.",
"devDependencies": {},
"engines": {
"atom": ">=1.1.0"
},
"homepage": "https://github.com/postcasio/tree-view-open-files#readme",
"license": "MIT",
"main": "./lib/tree-view-open-files",
"name": "tree-view-open-files",
"optionalDependencies": {},
"readme": "# tree-view-open-files\n\nShow open files in a list above the tree view. (like Sublime Text)\n\nShows a separate collapsible list for each pane.\n\n## Todo\n\n* Allow panes to be renamed\n",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git+https://github.com/postcasio/tree-view-open-files.git"
},
"version": "0.3.0"
}
15 changes: 15 additions & 0 deletions styles/tree-view-open-files.less
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@
position: relative;
order: 0;

.file-path {
color: rgba(171, 173, 164, 0.33);

.project-dir-name {
font-weight: bold;
}
}

.close-open-file {
visibility: hidden;
background: none;
border: none;
margin-left: -24px;
Expand All @@ -26,6 +35,12 @@
}
}

.list-item:hover {
.close-open-file {
visibility: visible;
}
}

.close-open-file::before {
font-family: 'Octicons Regular';
font-weight: normal;
Expand Down