jcb91 / jupyter_highlight_selected_word Goto Github PK
View Code? Open in Web Editor NEWJupyter notebook extension that enables highlighting every instance of the current word in the notebook
License: Other
Jupyter notebook extension that enables highlighting every instance of the current word in the notebook
License: Other
When I am coding in a Jupyterlab editor, I would like the variable where the cursor is placed to be highlighted throughout the editor. This makes following the code easier. I know that this extension is not about the editor but instead about the cells of a notebook. But, would it be possible to add to the text editor as well? Or, if there exists an extension that already does this, could you please point me to it? Thanks!
Thanks for the great extension!
I was wondering though, is it possible to have the highlighting happen throughout all code cells, not only within the current one? Best if configurable, of course. ;)
Hi, I was really excited to see this plugin. I have two questions:
First, is it possible to highlight only when the whole word has been highlighted instead of highlighting the current word wherever the cursor is?
Next, is it possible to change the highlighting from a background color to a light bounding box? E.g.
From #10 I've disabled the show_token
. The only concern remained is when I select a word, it highlights all occurrence of such string disregarding whether it's a word or part of a word. i.e. when I select rand
, it will also highlight the rand
in rand_number
. This behavior differs from common editors, though I'm not sure if you'd like to keep it. If the common way is preferred, I guess a workaround would be like the following (not sure yet).
// main.js line 147
if (selection.length >= params.min_chars) {
newOverlay = makeOverlay(selection, /[\w$]/, params.highlight_style);
}
Do you think it's reasonable, or you prefer keeping the original behavior?
It is great to have this helpful extension. thanks
Would it possible to also add an option for highlighting matches in the output of cells as well?
Thank you
Could not solve for environment specs
Encountered problems while solving:
- package jupyter_highlight_selected_word-0.2.0-py310hbe9552e_1005 requires python_abi 3.10.* *_cp310, but none of the providers can be installed
The environment can't be solved, aborting the operation
Noob here.
Even after I've tried disabling or removing it in the prompt it is not found.
What can I do?
I like the jupyter_highlight_selected_word so much! Thank you! @jcb91
There is a problem: I want to show all matches across all the cells, but only visible matches are shown. When I scrolled, additional matches were not highlighted until I switched to another page and switched back.
Here are my versions:
Python 2.7.14
Ubuntu 16.04 LTS
jupyter-highlight-selected-word (0.2.0)
Firefox 61.0(x64)
jupyter (1.0.0)
jupyter-client (5.2.3)
jupyter-console (5.2.0)
jupyter-contrib-core (0.3.3)
jupyter-contrib-nbextensions (0.5.0)
jupyter-core (4.4.0)
jupyter-latex-envs (1.4.4)
jupyter-nbextensions-configurator (0.4.0)
Here are my settings:
Highlight matches across all cells --> True
Only apply highlights to editors which are visible in the scrolled view --> False
Please help me...
As described in #9, this feature does not work to me. It seems that CodeMirror-selectedtext
isn't applied properly to selected texts under my chrome browser.
('seems' means that I'm not sure whether it's true. I could not observe this property well under chrome's devtool since it changes whenever I switched my mouse from the selected texts to the devtool window.)
Do you have ideas how could I verify this or any workarounds?
Hello,
I found this feature in v0.08 great: Prevent highlighting the currently-selected text, to make it clearer where the cursor is****
Though what I got was v0.07 as part of the jupyter_contrib_nbextensions collection.
I've also tried the following command.
conda install -c conda-forge jupyter_highlight_selected_word
Fetching package metadata .........
Solving package specifications: ..........
# All requested packages already installed.
# packages in environment at /anacondas/deepsim/envs/tensor3:
#
jupyter_highlight_selected_word 0.0.7 py35_0 conda-forge
It seems that the version under conda is v0.07.
Could it be easily solved? Thanks.
I recently upgraded to Jupyter Notebook 7. I wanted to know if the jupyter_highlight_selected_word is compatible with Notebook 7.
Hi Josh,
Thanks for the extension! Would it be possible to add the option to ignore comments inside code cells? I like this extension for highlighting variable and method occurrences, but when I'm typing comments, I typically don't want all occurrences of a word to highlight.
For what it's worth, it appears the default behavior of PyCharm is to ignore comments, while Sublime includes them, so users accustomed to different IDEs may choose differently. I think this makes a good case for the option to toggle on or off.
First, let me say thank you for a great extension!
My only problem with using this extension is that it overrides the highlighting of multi-cursor editing using Sublime keymap (ctrl^d) in a way that makes it unusable. The problem is that there is almost no way to see which instances of the selected word are selected in the multi-cursor editing and which are not.
Perhaps a work around could be to have the "highlight selected word" disabled by default, or at least persistent between notebook loads, so that I could turn the feature on when I need it only.
Thanks again,
Hello, thank you a lot for implementing this great feature. It really makes Jupyter get easier to use for coding.
I have noticed that when the option "Highlight matches across all cells. If false, only matches within the currently selected cell will be highlighted." is off, words which I select remain hilighted when I click on otehr cells. This hilighting becomes persistent even if I come back to the original cell and select another word. As time goes on and I select other words and then switch between cells back and forth, the number of hilighted increases and kills the benefit of your otherwise good extension.
Reloading the page will reset the hilighting. Also, as I aid before, activating the option "Highlight matches across all cells. If false, only matches within the currently selected cell will be highlighted." prevents this problem from happening.
I hope this ticket will be useful. PLease let me know if I can bring more details.
below are my jupyter related packages and their version:
jupyter (1.0.0)
jupyter-client (5.2.3)
jupyter-console (5.2.0)
jupyter-contrib-core (0.3.3)
jupyter-contrib-nbextensions (0.4.0)
jupyter-core (4.4.0)
jupyter-highlight-selected-word (0.1.0)
jupyter-latex-envs (1.4.1)
jupyter-nbextensions-configurator (0.4.0)
I'm using a dark theme. The bright green selection color contrasts badly. Can I change the selection color in the notebook.json file or would I have to download the repo, change the color in the main.js file and install from there?
I've tried to edit the color as instructed under the "Options" header in the readme but changing the color to "dim gray" or "#696969" doesn't seem to do anything. Thanks.
As the notebook accumulates more content after working on it for a while, does this feature make my notebook slow/lag/sluggish? Such as longer lagging time when typing in codes.
Hi !
Thank you for your many efforts on the notebook extensions ! Your work is amazing !
I am now trying to use this one. I have jupyter 4.3.0
and in the nbextension configurator, normally this one is greyed out, and shows 4.x
in red. Basically, it says it is incompatible.
And surely it is (or I don't know how to use it). I enabled it despite the incompatibility, reloaded a notebook and double-clicked a word in a code cell. Other instances of the word don't become highlighted.
I have setup the sublime keymap. Could that interfere, as I've seen in a different issue ?
Or is it just that my version of the extension is old ? I installed with pip install jupyter_contrib_nbextensions
and jupyter contrib nbextension install --user
.
Thanks again !
Hello,
Thank you very much for this extension.
I was trying to configure the extension in order for it to only highlight when the whole word is actually selected, rather than highlighting the words when I simply put the cursor between or beside a word (which is whats happening right now). How could I achieve the former configuration ?
Moreover, only want to highligh when I press ctrl
... how should I configure it ?
This is the configuration code I executed in python but it does not achieve what I mentioned above:
from notebook.services.config import ConfigManager
cm = ConfigManager()
cm.update('notebook', {'highlight_selected_word': {
'delay': 1000,
'code_cells_only': True,
'highlight_color': '#72055b',
'highlight_color_blurred': '#72055b',
'words_only': True,
'use_toggle_hotkey': True,
'toggle_hotkey': 'ctrl',
}})
Everytime I try to highlight selected text, the highlighter highlights the first instance in the cell rather than the selected text.
As it stands it highlights every time I place the cursor on a word (meeting the criteria set etc). I was after highlight only when I select the text with the mouse. I can do it using a hotkey I guess but I was after automating the process. This should reduce overhead as well.
Hi,
you might want to add "zip_safe=False" to setup.py
to ensure, that the pyhton egg is not installed as a file, but as a directory.
(check http://setuptools.readthedocs.io/en/latest/setuptools.html#setting-the-zip-safe-flag).
Currently this gives some trouble with jupyter_contrib_nbextensions:
ipython-contrib/jupyter_contrib_nbextensions#1269
Best,
Jens Henrik
The highlighting appears to be stuck on the selected word after scrolling down when only_cells_in_scroll
is true
.
Versions:
Highlight_selected_word 0.1.0
Chrome 64.0.3282.140
Notebook server 5.4.0
Python 3.6.3
IPython 6.2.1
MacOS 10.13.3 or Ubuntu 17.10
The notebook.json
:
{
"Notebook": {
"Header": false,
"Toolbar": true
},
"load_extensions": {
"code_prettify/autopep8": true,
"equation-numbering/main": true,
"hide_input/main": true,
"spellchecker/main": true,
"init_cell/main": true,
"livemdpreview/livemdpreview": true,
"python-markdown/main": true,
"highlight_selected_word/main": true,
"toc2/main": true,
"varInspector/main": true,
"collapsible_headings/main": true,
"hide_header/main": true,
"snippets_menu/main": true,
"zenmode/main": true,
"hinterland/hinterland": true,
"help_panel/help_panel": true
},
"toc2": {
"number_sections": false
},
"zenmode_use_builtin_backgrounds": false,
"zenmode_backgrounds": [
"http://localhost"
],
"highlight_selected_word": {
"code_cells_only": true,
"outlines_only": true,
"words_only": true,
"highlight_color": "#ff8000",
"highlight_color_blurred": "#ffb266",
"use_toggle_hotkey": true,
"enable_on_load": true,
"only_cells_in_scroll": true
},
"help_panel_add_toolbar_button": true
}
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.