-
Notifications
You must be signed in to change notification settings - Fork 194
Ability to see context of project search results - More lines #702
Conversation
@MartinMuzatko Can you add some screenshots? And a few questions:
Also, is indentation shown correctly? It seems to be missing in #190 (comment). |
@DouweM that is true, there is nothing implemented to detect line collisions as shown below: Is there a way to detect tabs? I do have the space in the lines, but I have to find out what other options are in the buffer class. Maybe also the identation Also what bugs me, is that the matches are not separated. it is just a blog of code with the highlight in the middle. The I'll continue working on this. Thank you very much for your input @DouweM ! |
This is likely simply a CSS issue where consecutive spaces are collapsed into one, note that in your screenshot, line 35 appears to have one space of indentation even though it should have more. Try
I don't mind that, actually. It's the same way Sublime did it: #190 (comment) |
@MartinMuzatko Another suggestion while you're at this: Have the search results use the same monospace font as elsewhere in text editors. |
Now I need to deal with Promises, because I need to build the buffer in order to get the lines:
|
Currently I'm learning how to deal with js scope in coffeescript. Any help to solve the promise problem is very much appreciated. class MatchView extends View
@content: (model, {filePath, match}) =>
linesPromise = atom.project.buildBuffer(filePath)
linesPromise.then (lines) ->
@getContent(model, {filePath, match, lines})
getContent: (@model, {filePath, match}) ->
range = Range.fromObject(match.range)
matchStart = range.start.column - match.lineTextOffset
...... It seems like the scope of the promise has no access to @ (this) |
@MartinMuzatko Check out the fat arrow: http://coffeescript.org/#fat-arrow |
I have another problem of finding documentation on the View Class. It seems like I have to find another way around, the fat arrow still gives me the window as scope.. I think the best thing to do, is to actually save suffix/prefix in the result as the search is done, not when the view is output. There I can retrieve all the data before I return a view. |
@MartinMuzatko Your
Sounds reasonable to me. |
Thank you for the pointers, I'll do my best to fix this :) |
Have another look please @DouweM. The navigation doesn't work that great yet, buffer lines are now retrieved via model, where it belongs to.
Fixing known issues
Updated the initial text for tasks |
@emitter.emit 'did-add-result', {filePath, result, filePathInsertedIndex} | ||
bufferPromise = atom.project.buildBuffer(filePath) | ||
bufferPromise.then (buffer) => | ||
result.lines = buffer.lines |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it's a good idea to pass all lines rather than just those that will be used.
I'm not on the Atom team or anything though, so they may be fine with it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I can tell buildBuffer
just to build the lines I need. The API Docs are really missing a lot of information unfortunately: https://atom.io/docs/api/v1.6.2/Project.
I recently researched a bit and it seems like "buildBuffer" uses text-buffer. https://github.com/atom/text-buffer/blob/master/src/text-buffer.coffee
There it looks like it is possible to pass an amount of lines to build from.
However, from the modelside, I can just use the lines required :)
Recently continued my work, commits are here soon. the 2 suffix and prefix lines are now added within the results-model. Should we just merge resutls that are in the same line @DouweM ? like
|
@MartinMuzatko That would be really nice |
How is the progress? I want the feature. |
Hello there! Currently I'm pretty busy. The results so far is not quite done yet. Please feel free to build upon what I have created so far. I'll resume once I have some time again for open source projects. Thanks |
@MartinMuzatko You are great! |
+1 |
I want you! @MartinMuzatko |
Please see #847 for another working proposal. |
With #847 being merged this can probably be closed. |
Closes #190
This is my first contribution to an official core atom package.
I know that this PR is missing the ability to configure the amount of lines to see.
Any hints on how to improve this PR is very much appreciated.
I acknowledge the importance of this package to work properly, so please point out any required improvements.
The additions are not tested via Jasmine/Mocha or whatever testing engine you use. No specs provided.
Features
Fixing known issues
Current Status
