dfreds / code-peek-atom Goto Github PK
View Code? Open in Web Editor NEWAtom package to peek functions in different files
License: MIT License
Atom package to peek functions in different files
License: MIT License
steps to reproduce:
Atom Version: 1.13.1
Electron Version: 1.3.13
System: Microsoft Windows 10 Pro
Thrown From: code-peek package, v1.4.15
Uncaught TypeError: Cannot read property 'ignoreCase' of undefined
At C:\Users\Jan Willem\AppData\Local\atom\app-1.13.1\resources\app.asar\src\default-directory-searcher.js:11
TypeError: Cannot read property 'ignoreCase' of undefined
at new DirectorySearch (C:\Users\Jan Willem\AppData\Local\atom\app-1.13.1\resources\app.asar\src\default-directory-searcher.js:11:26)
at DefaultDirectorySearcher.module.exports.DefaultDirectorySearcher.search (C:\Users\Jan Willem\AppData\Local\atom\app-1.13.1\resources\app.asar\src\default-directory-searcher.js:61:25)
at C:\Users\Jan Willem\AppData\Local\atom\app-1.13.1\resources\app.asar\src\workspace.js:978:40
at Map.forEach (native)
at Workspace.module.exports.Workspace.scan (C:\Users\Jan Willem\AppData\Local\atom\app-1.13.1\resources\app.asar\src\workspace.js:957:30)
at Object.scanWorkspace (file:///C:/Users/Jan Willem/.atom/packages/code-peek/lib/code-peek.coffee:115:20)
at Object.peekFunction (file:///C:/Users/Jan Willem/.atom/packages/code-peek/lib/code-peek.coffee:110:6)
at atom-text-editor.subscriptions.add.atom.commands.add.code-peek:peekFunction (file:///C:/Users/Jan Willem/.atom/packages/code-peek/lib/code-peek.coffee:57:37)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (C:\Users\Jan Willem\AppData\Local\atom\app-1.13.1\resources\app.asar\src\command-registry.js:259:29)
at CommandRegistry.handleCommandEvent (C:\Users\Jan Willem\AppData\Local\atom\app-1.13.1\resources\app.asar\src\command-registry.js:3:59)
at CommandRegistry.module.exports.CommandRegistry.dispatch (C:\Users\Jan Willem\AppData\Local\atom\app-1.13.1\resources\app.asar\src\command-registry.js:160:19)
at AtomEnvironment.module.exports.AtomEnvironment.dispatchContextMenuCommand (C:\Users\Jan Willem\AppData\Local\atom\app-1.13.1\resources\app.asar\src\atom-environment.js:1181:28)
at EventEmitter.outerCallback (C:\Users\Jan Willem\AppData\Local\atom\app-1.13.1\resources\app.asar\src\application-delegate.js:332:25)
at emitThree (events.js:116:13)
at EventEmitter.emit (events.js:194:7)
-2:15.6.0 code-peek:peekFunction (span.syntax--text.syntax--plain.syntax--null-grammar)
-1:43.4.0 find-and-replace:select-next (a.stack-toggle)
-1:43 core:save (a.stack-toggle)
2x -1:33.7.0 code-peek:peekFunction (span.syntax--text.syntax--plain.syntax--null-grammar)
-0:33.8.0 tree-view:move (ol.tree-view.full-menu.list-tree.has-collapsable-children.focusable-panel)
-0:32.7.0 editor:move-to-end-of-screen-line (input.hidden-input)
-0:31.8.0 core:confirm (input.hidden-input)
2x -0:28.2.0 code-peek:peekFunction (span.syntax--entity.syntax--name.syntax--function.syntax--js)
-0:17.2.0 bookmarks:jump-to-next-bookmark (input.hidden-input)
-0:16.9.0 tree-view:move (ol.tree-view.full-menu.list-tree.has-collapsable-children.focusable-panel)
-0:15.7.0 core:move-right (input.hidden-input)
2x -0:15.3.0 editor:select-to-end-of-word (input.hidden-input)
-0:14.5.0 core:delete (input.hidden-input)
-0:14.3.0 core:confirm (input.hidden-input)
2x -0:10.7.0 code-peek:peekFunction (span.syntax--entity.syntax--name.syntax--function.syntax--js)
-0:00.4.0 application:new-file (ul.list-inline.tab-bar.inset-panel)
{
"core": {
"audioBeep": false,
"disabledPackages": [
"spell-check",
"snippets"
],
"followSymlinks": false,
"packagesWithKeymapsDisabled": [
"fonts"
],
"projectHome": "C:\\Software\\",
"telemetryConsent": "limited"
}
}
# User
atom-easy-jsdoc, v4.10.0 (active)
atom-html-preview, v0.1.22 (active)
code-peek, v1.4.15 (active)
emoji-syntax, v1.6.2 (active)
fonts, v2.0.0 (active)
jsdoc-generator, v0.2.3 (active)
markdown-scroll-sync, v2.1.2 (active)
minimap, v4.26.8 (active)
minimap-cursorline, v0.2.0 (active)
minimap-find-and-replace, v4.5.1 (active)
minimap-git-diff, v4.3.1 (active)
minimap-highlight-selected, v4.5.0 (active)
minimap-selection, v4.4.0 (active)
node-debugger, v1.10.0 (active)
single-click-open, v0.2.2 (active)
atom-dark-syntax, v0.28.0 (inactive)
atom-dark-ui, v0.53.0 (inactive)
atom-light-syntax, v0.29.0 (inactive)
atom-light-ui, v0.46.0 (inactive)
base16-tomorrow-dark-theme, v1.4.0 (inactive)
base16-tomorrow-light-theme, v1.4.0 (inactive)
one-dark-ui, v1.8.2 (active)
one-light-ui, v1.8.2 (inactive)
one-dark-syntax, v1.6.0 (active)
one-light-syntax, v1.6.0 (inactive)
solarized-dark-syntax, v1.1.1 (inactive)
solarized-light-syntax, v1.1.1 (inactive)
about, v1.7.2 (active)
archive-view, v0.62.0 (active)
autocomplete-atom-api, v0.10.0 (active)
autocomplete-css, v0.14.1 (active)
autocomplete-html, v0.7.2 (active)
autocomplete-plus, v2.33.1 (active)
autocomplete-snippets, v1.11.0 (active)
autoflow, v0.29.0 (inactive)
autosave, v0.23.2 (active)
background-tips, v0.26.1 (active)
bookmarks, v0.43.2 (active)
bracket-matcher, v0.85.1 (active)
command-palette, v0.39.1 (inactive)
deprecation-cop, v0.55.1 (active)
dev-live-reload, v0.47.0 (active)
encoding-selector, v0.22.0 (active)
exception-reporting, v0.40.0 (active)
find-and-replace, v0.204.5 (active)
fuzzy-finder, v1.4.0 (active)
git-diff, v1.2.0 (active)
go-to-line, v0.31.2 (inactive)
grammar-selector, v0.48.2 (active)
image-view, v0.60.0 (active)
incompatible-packages, v0.26.1 (active)
keybinding-resolver, v0.35.0 (active)
line-ending-selector, v0.5.1 (active)
link, v0.31.2 (inactive)
markdown-preview, v0.159.3 (active)
metrics, v1.1.3 (active)
notifications, v0.65.1 (active)
open-on-github, v1.2.1 (inactive)
package-generator, v1.0.2 (inactive)
settings-view, v0.244.0 (active)
snippets, v1.0.4 (inactive)
spell-check, v0.68.5 (inactive)
status-bar, v1.6.0 (active)
styleguide, v0.48.0 (active)
symbols-view, v0.113.1 (inactive)
tabs, v0.103.1 (active)
timecop, v0.33.2 (active)
tree-view, v0.211.1 (active)
update-package-dependencies, v0.10.0 (active)
welcome, v0.35.1 (active)
whitespace, v0.35.0 (active)
wrap-guide, v0.39.0 (active)
language-c, v0.54.0 (active)
language-clojure, v0.22.1 (active)
language-coffee-script, v0.48.1 (active)
language-csharp, v0.13.0 (active)
language-css, v0.40.1 (active)
language-gfm, v0.88.0 (active)
language-git, v0.15.0 (active)
language-go, v0.43.0 (active)
language-html, v0.47.1 (active)
language-hyperlink, v0.16.1 (active)
language-java, v0.24.0 (active)
language-javascript, v0.122.0 (active)
language-json, v0.18.3 (active)
language-less, v0.29.6 (active)
language-make, v0.22.2 (active)
language-mustache, v0.13.0 (active)
language-objective-c, v0.15.1 (active)
language-perl, v0.37.0 (active)
language-php, v0.37.3 (active)
language-property-list, v0.8.0 (active)
language-python, v0.45.1 (active)
language-ruby, v0.70.2 (active)
language-ruby-on-rails, v0.25.1 (active)
language-sass, v0.57.0 (active)
language-shellscript, v0.23.0 (active)
language-source, v0.9.0 (active)
language-sql, v0.25.0 (active)
language-text, v0.7.1 (active)
language-todo, v0.29.1 (active)
language-toml, v0.18.1 (active)
language-xml, v0.34.12 (active)
language-yaml, v0.27.1 (active)
# Dev
No dev packages
when I open multiple projects,can i peek functions at current project?
Takes up a fair bit of unnecessary room.
What do you think about adding an option to restrict some directories to search in, such as vendor for PHP or node_modules for JS?
Maybe it can help to search faster.
Thank you.
Currently, MagicPython syntax is not supported even when MagicPython is an alias of Python language.
Maybe we can improve the detection to support this.
Thanks
Atom: 1.17.0-beta5 x64
Electron: 1.3.15
OS: Mac OS X 10.12.4
Thrown From: code-peek package 1.4.18
Uncaught Error: Can't save destroyed buffer
At /Applications/Atom Beta.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:1114
Error: Can't save destroyed buffer
at TextBuffer.module.exports.TextBuffer.saveAs (/Applications/Atom Beta.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:1114:1)
at TextBuffer.module.exports.TextBuffer.save (/Applications/Atom Beta.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:1108:1)
at TextEditor.module.exports.TextEditor.save (/Applications/Atom Beta.app/Contents/Resources/app/src/text-editor.js:925:1)
at CodePeekView.module.exports.CodePeekView.saveChanges (/packages/code-peek/lib/code-peek-view.coffee:187:27)
at Object.toggleCodePeekOff (/packages/code-peek/lib/code-peek.coffee:226:19)
at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom Beta.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:25:1)
at Emitter.module.exports.Emitter.emit (/Applications/Atom Beta.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:141:1)
at /packages/code-peek/lib/code-peek-view.coffee:67:16)
at HTMLSpanElement.dispatch (/packages/atom-beautify/node_modules/jquery/dist/jquery.js:4435:9)
at HTMLSpanElement.elemData.handle (/packages/atom-beautify/node_modules/jquery/dist/jquery.js:4121:28)
I'm trying to use code-peek 1.4.16 with Semanticolor, but there's a conflict. The problem is that to do its highlighting, Semanticolor prefixes the name of the current grammar with "semanticolor", so code-peek gives the error "Peek function does not currently support semanticolor - Ruby files".
So...perhaps it should ignore the "semanticolor" prefix or find some other way of determining the language?
I thinks it'll be awesome if combined with hyperclick
https://github.com/facebooknuclide/hyperclick
Peek function does not currently support Babel ES6 Javascript files. New to React and Atom so if there's a config file you want to see let me know.
If I'm opening the full file, I don't need the panel to remain open. It should automatically close itself upon opening the file.
This plugin is awesome. However on a large project or when working on a busy drive or a or network folder, it can be extremely slow to find the function, even when it's in the same file as I'm working in. I've had cases of waiting 2-3 minutes at times. code-peek is basically useless in these cases.
I would like to suggest creating an index for each project and searching that rather than the entire codebase. It could be something as simple as a text file containing the name, path & line no of each function. We could then just update the relevant part of the index when each file is saved.
TS uses classes as JS uses function as constructor.
Here is the propose regex:
class\s+REPLACE(\s+extends\s+[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*|)\s+{
This should cater for scenarios:
class Replace {}
class Replace extends Base {
export class Replace {}
export class Replace extends Base {}
I've been using this locally and it seems to work as expected. Assuming gofmt is used.
'go':
regExp: ///
# Matches func REPLACE( or func (t target) REPLACE(
func\s+(|\(.*\)\s+)REPLACE\(
///
isTabBased: true
Matching:
Should be quite similar to JavaScript support, it actually wouldn't surprise me if code-peek just has to ignore that the file is written in JSX instead of JavaScript.
Many people are moving to ES6.
Kinda cool thing to do nowadays (i myself hate but that's my opinion)
This format isn't supported yet.
methodName() {
}
Similar to the behavior in brackets, instead of expanding the panel away from the cursor, it would be nice if it could be done closer to the cursor itself. One of the things brackets does is that it only peeks the function (not the entire file) and therefore there is no scrolling within the peek panel. It simply expands some lines in the middle of the document.
PL/SQL (Oracle)
Hi i'm andre is possible add css to the supprot fiels? where i can tweak the code to do that?
[Enter steps to reproduce below:]
Atom Version: 1.8.0
System: Mac OS X 10.11.5
Thrown From: code-peek package, v1.4.8
Uncaught SyntaxError: Invalid regular expression: /function\s \s(|*\s_(=|:)\s_function\s*(/: Nothing to repeat
At /Users/18740973/.atom/packages/code-peek/lib/supported-files.coffee:160
SyntaxError: Invalid regular expression: /function\s **\s*\(|**\s*(=|:)\s*function\s*\(/: Nothing to repeat
at new RegExp (native)
at Function.module.exports.SupportedFiles.getFunctionRegExpForFileType (/Users/18740973/.atom/packages/code-peek/lib/supported-files.coffee:160:16)
at Object.module.exports.CodePeek.peekFunction (/Users/18740973/.atom/packages/code-peek/lib/code-peek.coffee:108:29)
at atom-text-editor.subscriptions.add.atom.commands.add.code-peek:peekFunction (/Users/18740973/.atom/packages/code-peek/lib/code-peek.coffee:57:37)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:260:29)
at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:61)
at CommandRegistry.module.exports.CommandRegistry.dispatch (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:160:19)
at AtomEnvironment.module.exports.AtomEnvironment.dispatchContextMenuCommand (/Applications/Atom.app/Contents/Resources/app.asar/src/atom-environment.js:1106:28)
at EventEmitter.outerCallback (/Applications/Atom.app/Contents/Resources/app.asar/src/application-delegate.js:340:25)
at emitThree (events.js:97:13)
at EventEmitter.emit (events.js:175:7)
-1:11.1.0 core:save (atom-text-editor.editor.is-focused)
3x -0:27.7.0 code-peek:peekFunction (atom-text-editor.editor.is-focused)
{
"core": {
"disabledPackages": [
"linter-bootlint",
"fonts",
"symbols-view"
],
"themes": [
"one-dark-ui",
"solarized-dark-syntax"
]
}
}
# User
aligner, v0.22.0
aligner-css, v1.2.0
aligner-scss, v1.1.0
angularjs, v0.3.4
atom-beautify, v0.29.10
atom-ctags, v4.5.2
atom-html-preview, v0.1.21
atom-svg-icon-snippets, v0.3.3
auto-detect-indentation, v1.1.0
autoclose-html, v0.23.0
autocomplete-awk, v0.1.2
autocomplete-html-entities, v0.1.0
autocomplete-js-import, v1.0.1
autocomplete-json, v5.1.0
code-peek, v1.4.8
emmet, v2.4.3
file-icons, v1.7.17
file-watcher, v0.4.0
font-viewer, v0.3.1
fonts-cjk, v0.1.2
highlight-selected, v0.11.2
jQuery, v1.2.4
language-svg, v0.9.0
linter, v1.11.14
linter-jshint, v2.1.0
linter-jsonlint, v1.3.0
linter-sass-lint, v1.6.1
minimap, v4.24.7
pigments, v0.31.2
project-manager, v2.9.7
semanticolor, v0.2.2
svg-preview, v0.7.4
terminal-plus, v0.14.5
# Dev
No dev packages
trying to peek at an JS arrow function results in the warning "Could not find function "fnName" in project."
const foo = x => x*2
foo( 10 )
peeking at the foo call generates the warning
Right now tsx
aren't supported when they could be. Even better would be to support components peek
When you peek into a function the "peeked window" only starts at the current method. In other systems (VSC) you can scroll forwards and backwards in peeked code.
As part of #29 (PR #30) everything works but does not peek into spec files. Oracle PL/SQL code is usually defined in two files: pks
(spec) and pkb
(body).
"public" constants are defined in the pks
file. code-peek doesn't seem to find their definitions in the spec file. Any idea why it doesn't work?
Update
Upon further analysis the code only looks at files of the same file type. In the case of languages that have the spec and body in separate files this may prevent the search from finding the files. For Oracle developers packages are usually named pkg_name.pks
(spec) and pkg_name.pkb
(body). In the body's code it will only search for other pkb
files. This is not necessarily a bad thing but some times I want to search the spec file for global constants and types. This logic is in lib/code-peek.coffee
in function constructPathsArray
.
This also raises the question: Should we look through all the files with the same extension or use the package name as the search. For example in code is usually referenced as my_package.my_function
. Why should I have Atom search through all the *.pkb
files when I know that I can determine that it should search for my_function
in a file that starts with my_package
. This may improve search time as it is currently a bit slow.
Would the above proposal work for other languages as well?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.