-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tab inserts tab #55
Tab inserts tab #55
Conversation
Add a constant, TAB_KEY, equal to 9.
Add a key "tab_inserts_tab", with value ".rest-client-tab-inserts-tab", to the rest_form object.
Add a div element between Saved requests and Headers with a checkbox to toggle the tab inserts tab option.
If the "tab inserts tab" option is checked when pressing the tab key in a textarea element, then it will insert a tab character.
Remove the key "tab_inserts_tab" from the rest_form object and remove the div containing the checkbox for the option.
Add a checkbox to toggle an option to insert a tab character whenever the tab key is pressed.
Remove all changes made.
Add a command to Atom in the scopes for .rest-client-headers and .rest-client-payload called rest-client:insertTab to call insertTab(). Add an Atom configuration observer to add or remove a keymap for the tab key when the tab inserts tab option is changed. Add a method called insertTab() that manipulates the textarea element to insert a tab character.
Change "if start == end" to "if start is end" as suggested by Codacy.
Hello. I'm not too familiar with CoffeeScript but I did try to adhere to the style in the existing source code. Codacy is telling me that there's inconsistent indentation in what I wrote but it doesn't seem out of place. Can somebody please point me in the right direction to make the appropriate corrections? Thank you. |
as long as your editor (and you) abide by the |
Refactor "tab inserts tab"-related code to reduce redundancy and adhere more to CoffeeScript's style.
end = event.target.selectionEnd | ||
endText = if start is end then text.slice(start) else text.slice(end, text.length) | ||
|
||
event.target.value = text.slice(0, start) + '\t' + endText |
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 might be biased, but @javaguirre , do you think \t
should be
(two spaces instead of\t
? this is difficult for me to answer.
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.
Hi Dj. I can add an option to allow the user to choose or input their own character(s) to insert, if that's preferred.
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.
that's a great idea @bernardlee ! great way to settle in the middle :)
I think two options:
Dropdown: Space/Tabs
Length: 2/4
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.
or if you want, leave the length a text field, and default to "2".
Rename tab_inserts_tab to tab_key_behavior and change its type to an object to represent a group of settings. Add an option to enable soft tabs and another to determine the length.
Add all functionality that the new whitespace options represent: soft tabs and their length.
I added a couple of options to enable or disable soft tabs and to determine their length. There's probably a better way to implement this functionality than the way that I did it, but I'm still new to playing with the Atom API so let me know if there's a better way and I'll update it. |
you sir, deserve a cookie. 🍪 thanks so much |
available as v1.2.4 |
Thank you! |
I've moved the tab inserts tab option to the package configuration view. Having the option checked will make the tab key insert tab characters in the textarea elements in the headers and payload sections.