Atom editor - TODO highlight for JS? - javascript

In Atom editor, TODOs are automatically highlighted with atom/language-todo package, and I can change the style using user stylesheet. That much I know.
So I'm developing a webpage right now, and have to simultaneously work with HTML, CSS, and JS. However it seems that TODOs are only highlighted for HTML and CSS files, not JS files. This is strange because in the settings for atom/language-todo, the scope for all triggers are .html.php.text - HTML is included; CSS and JS are not. So reasonably thinking, either both CSS and JS should have highlight enabled, or both should have it disabled.
What is causing this strange behavior? Is there anything I can do to enable highlighting for JS?
P.S. Currently mrodalgaard/atom-todo-show is my alternate solution. It's quite good but I would still like to have my highlights.

This problem is probably related to this open issue on the atom/language-todo repository: https://github.com/atom/language-todo/issues/82.
As someone suggests in the issue conversation, the todo highlighting can be restored by disabling Atom tree-sitter in the settings:core page.
For more information on how the tree-sitter improves code parsing, see the release article on the Github blog

Related

VS 2022 No longer allows me to drag and drop links to css/js files

In VS 2019, You're able to drag a JS or CSS file and it'll automatically create the src link to that file. In 2022 this functionality is no longer there, When looking for solutions I only saw two possibilities:
Make sure Drag and Drop Text Editing is enabled (It is, not the fix)
Disable LSP in Preview features in the environment section (Can't even see this option, even on latest version)
Any help would be appreciated as this does limit how fast we are able to complete our work.
You can still use them.
There is a work around suggested by Microsoft: Tools-->Options-->Text Editor-->HTML-->Advanced-->Use Legacy Razor Editor for Asp.NET (Yes) -->OK
And restart the visual studio.

Adding an attribute to html <video> tag using Javascript or Jquery. - WordPress Case

I have a WordPress installation and I share some links like the following to students watching courses - presentations online.
https://emgncv.net/wp-content/uploads/2020/10/108_I_Interpretation_Case_Study.mp4
The big issue that I am facing here is that I want to find a piece of code (probably Javascript or Jquery) to add "On document ready" so when students load the presentations on their browsers not being able to download the video from the 3-dots menu on the right bottom corner of the media player. Please, view the screenshot attached.
For the records, I have noticed this only on Google Chrome and Microsoft Edge. Mozilla does not offer such a download option.
What I have already tried is the following:
$('video').attr('controlsList', 'nodownload');
FYI, I have placed this code in a section where my WordPress theme provider lets me add some custom JS code. The section works pretty fine. I have already implemented others functions and everything works properly.
Do you have any ideas on what I will need to look at to achieve the following by default when my students load their courses on browsers?
Thank you so much in advance,
George.

Facebook Comment Box Disappears in Accordian

I have two examples of Facebook comment box failing to load when an accordian is collapsed and reloaded. One HTML/JavaScript basic and the other in a Wordpress site via Visual Composer - this problem also occurs in numerous other accordions
HTML Example - http://iknowdigital.co.uk/htmlexample/
Wordpress Via Visual Composer http://thesingingmajor.co.uk/test-comment-box-martin/
I have contacted Facebook Support and Visual Composer support and neither can help out.
here are the replies
From VC
Hi Martin, The issue is not with the iframe, but the js that facebook comments use to render. It is not able to re-initialize itself when it is displayed as hidden and hence the issue occur. You can see that when you add nay iframe, it works fine without any issue. It is the js from the comments which is restricting it. As mentioned previously, it will require some custom js code to re-initialize this loading when the closed (hidden) accordion is opened. Kindly check.
From Facebook
Hi Martin,The issue here is the way the library is working. If you debug the code you'll see the plugin does not disappear, the issue is that the library is changing the width of the iframe that contains the plugin to 0 and you cannot see the comments plugin. In order to avoid this situation you will have to manually change the width value again and you'll see the comment plugin is still there. I'm going to close this bug as "By design" as this is not an issue in our side.
I'm not a javascript programmer, so am really at a loss here. Can anyone chip in with some advice here?
Thanks Martin

Using multiple CodeMirror editors on a single page?

I'm writing a page with examples that demonstrate the use of my js library. I'd like these examples to be editable and runnable, so I thought I have these options :
Use prettify to display code on the tutorial page, have a button that opens a new window with the editor where you can run the code (currently implemented solution). Alternatively, I can make the editor a modal dialog of some sort.
Use multiple CodeMirror editors for each example on the page (could be up to 30 on a single page). I'm not sure how "heavy" those editors are, so I'm not sure if that's a good idea.
Have an edit button that "swaps" prettyfied code with a CodeMirror editor when editing is needed, so that the user can edit and run the examples without bothering with new windows. I'm not sure if I can make prettify and CodeMIrror's syntax highlighting to look the same.
Any ideas on how I should do this and why? I'm also open to suggestions about different code editors or syntax highlighters too, so if anybody has experience with this kind of thing, please tell me how you did it.
You could use the same technique that Marijn Haverbeke (the creator of CodeMirror) uses for the online version of his javascript book. It shows code snippets, and provides an edit-button that opens a javascript console at the bottom of the screen.
Look at this chapter for an example.

Aptana Studio 2 - Code Assist for JS is not working

My problem is somewhat strange. I have started developing a web page with Aptana Studio build 2.0.5.1278522500. Everything went fine up to the moment when I wanted to start writing JavaScript in a separate .js file - there's no code assist for it. In the preferences it's enabled, and - that's the strange part - it works perfectly well in the .html files (when typing code in the script tag). The only thing that could remotely tell there's something wrong is the fact, that when I type, say, "document" and hit the '.' key, the cursor disappears for a split of a second.
Did anyone have the same problem? Is there any solution to that? I'd like code assist for JS very much, without it Aptana somewhat loses it's appeal.
As CodeMonkey mentioned we can do the same at Aptana Stuidio version 3. I mean follow this path: (Preferences->General->Editors->File Associations). Select js at top list but because at studio 3 we should select JavaScript Source Editor as default. It did not work change it to another option save and again bring it back to JavaScript Source Editor (It happened for me). Now you can use it.
I found an answer to my question, I'll post because maybe it'll help someone. To get the code assist working I just changed file the default editor for .js files from JavaScript editor to Aptana JS editor (Preferences->General->Editors->File Associations, then selected *.js in the top list and Aptana JS Editor in the bottom list, then clicked the "Default" button). Now it works like a charm.
I got a similar problem on Aptana 3 Studio. I cannot reproduce the problem now and there is no option for Aptana JS Editor in 3. I think the key to solve the problem is: used the template to generate a new file, don't try to just rename a blank normal file, if so, you need to closed the file and reopen it.
Associating .js files with Aptana did not resolve this problem.
I noticed that when I type jquery(this). , I get code assistance and there was no assistance when I types $(this). So I fixed this thing temporarily by placing this statement
$ = jQuery;
at the start of my .js file, thus declaring the $ as an equivalent to the jquery function.
While writing Javascript code in HTML editor, you don't need to do that becuase you have included the jQuery reference at the top which has the above setting ($ = jquery).

Categories

Resources