How to highlight/detect unique word in Sublimetext 2 - sublimetext2

I found a plugin (sublimelinter) for this task but it is for specific languages.
Do you know a way to highlight/detect unique word in Sublime Text for all programming languages ?
To be clear I'm looking for a way to detect unused variable via a plugin wich detect unique word in a code since a unique word is generally also unused (It is not totally true but still it is not a problem if it wrongly detects few words such as "static","serial" and so on for c++. Ideally I should be able to list words to exclude).
Important : I do not want a solution in which I have to compile my code.

There is plugin SublimeClang. It provides auto complete suggestions and error / warning reporting.

Related

vscode package.json String does not match the pattern

I am trying out VSCode on an existing project that uses npm and has a package.json file with a corresponding "name:" key that reads "SpecPro-File-Management-UI". VSCode is objecting to this line with "String does not match the pattern ...", apparently because of the upper-case characters in the name.
This problem is described in a VSCode issue which is closed. Which leaves me with advice to setup a custom schema for my package.json file. This is pretty unfriendly, and a barrier to adopting VSCode. I don't want to spend my time on custom schemas. I don't want to rename my project. I just want to edit my code and take advantage of the many VSCode goodies without distracting messages that are wrong.
Considering that using uppercase characters for npm packages is a VERY common practice, it seems most reasonable that VSCode should adopt either a more friendly schema or an easy way to override the standard schema. As far as I can tell, I have to make my own personal schema to resolve this problem. That's a lot of work and future maintenance for such a simple issue.
Is there an easy way to banish this erroneous error message?
This behavior is by design to enforce NPM conventions for the package.json file (to paraphrase, "lower-case only"). I agree it is a nuisance, especially since the project name is often pre-filled, e.g. by "create-react-app". As you point out, it is possible to create a custom schema to ignore this, but it's really not recommended. There isn't any alternative at this time. Myself, I just change the value to lower-case.
Use name field value in lowercase separated by hyphen (-).
In tsconfig.json add this line or set its value to false.
This worked for me.
"forceConsistentCasingInFileNames": false, // Fix for name regex pattern

Is there anyway to undo only parts of code that are highlighted in sublime text

Are there any plugins that would do this? Let's say you highlight a code block, when you press undo, it undoes the last change with in that code block?
I've done a lot of digging into Sublime's internals, and I don't think this is possible. Commands (processes executed when you select a menu item or hit a key combination) are implemented in one of two ways: either in Python, making use of the API, or internally in C++ and compiled directly into the executable or a library. If a command is implemented in pure Python, such as delete_word (source in Packages/Default/delete_word.py), you can edit the source if necessary or take portions to use in your own code. However, if a command is implemented internally, there's not much you can do to modify it, unless it has options that are documented somewhere. You basically have to use it as-is.
Which brings us to the undo/redo commands, and the edit history. As far as I can tell (since Sublime is not open source - yet), this entire functionality is completely implemented internally, with only the command names exposed. I have been completely unable to find any way of viewing or accessing the actual changes made to the undo/redo stack. The command_history() method of the sublime.View class accesses the commands in the undo/redo stack, but not the actual changes they made.
So, all of this is to say that one could not likely make a plugin that could access the change history of an arbitrary selection in Sublime. One of the major issues (aside from the fact that the change history of the view is not accessible) is that the text you select now might not correspond to anything at a certain point in the history - it might not exist, or could have been altered so fundamentally that it would be essentially impossible to identify which changes should be associated with the selection, and which not. I have never heard of a similar feature in any other editor, most likely for that exact reason.

Determine if a key sequence has already been assigned in Sublime Text

Does Sublime Text (2|3) have an API method or some way of determining if a shortcut or hot key sequence has already been assigned? I have lots of plugins and macros installed, and when making new ones it can be difficult to determine what key sequence to assign it to so I don't conflict with something else. Key bindings can be assigned in .sublime-keymap files in Packages/Default, Packages/User, and whichever plugin wants to assign them. To make things more complicated, I work on three different OSes, and there are different keymaps for each platform. Do I have to keep manually searching all the keymap files myself, or is there a better way to do it?
You might try installing and using FindKeyConflicts.
You can also open a console ctrl + ` and enter sublime.log_commands(True). You can then enter your shortcut/key sequence and see what, if anything, is bound to it.

Concflicting Sublime text 2 packages/plugins/snippets

Have you ever experienced conflicts/bugs after installing one new package/plugin or snippets on Sublime Text 2 (i.e. conflicting shortcuts)?
Note to who down voted the question: it is your right to think it is a question that shouldn't be asked.
But, if like me, you have spend a great deal of time trying to find why the plugin you just have properly installed isn't working the way it should then you might reasonably be interested in finding some ressources listing known plugin conflicts.
Yes it is certainly possible, and honestly quite likely that plugins will conflict. Though I can't give a specific example where having 2 plugins installed causes one to break or have unexpected behavior (perhaps some of the autocomplete plugins cause this), conflicting shortcuts are certainly possible. There are only a finite amount of (comfortable) key combinations, so some are bound to conflict.
If you see some unexpected behavior (with regards to key bindings) after installing a plugin, might I suggest running the FindKeyConflicts (note this plugin is developed by me) plugin. It should display any key conflicts that occur between packages.

CHM (htmlhelp) search for keyword

I'm trying to interface the htmlhelp api (which is a big word for one function in two variants), and I have a problem with the following usecase:
Assume I have a simple programmer's editor, with a bunch of helpfiles (.CHMs). Some are from the core runtime library, some from more exotic libraries. Assume the CHMs are crafted normally, and their indexes contains all keywords I want to search. I want to be simply able to search through the various CHMs when a user presses F1 on a keyword in the editor
So roughly I want (in pseudo code):
firstchm
while not (out of CHMs) and not Found
{
if keyword in CHM then
{
found=true;
break;
}
nextchm;
}
I've played a bit with HH_HELP_TOPIC, but that would pop up a window for every attempted file, and worse it would be dog slow since the CHMs would not remain cached.
Is there really no solution except DIY with e.g. chmlib? Or is it worth making a study of merged CHM files first?
Language is Delphi or clone, but anything win32/COM and somewhat readable will do.
(edit) Search results for nested index entries might be the next problem:
HTML Help keyword lookup
(/edit)
update 2
After a long time, I got a potential hint elsewhere. Craft a CHM runtime that merges all the other CHMs. Windows will generate CHWs for it containing all the slave CHM's TOC and indexes. Requires Binary TOC=off and Binary Index=on though, for all slave CHMs, and a CHM compiler installed/available. But since that is CHM workshop default, that might be not too bad.
Do you want to create an index or do a one-time search for these keywords?
Couldn't you extract the HTML content from the CHM files with logical filenames, search the HTML content, and relate that back to the CHM file?