Sublime Text on OSX: Spell checker does not learn - macos

I'm trying to get the/a spell checker working for ST2 on OSX (10.6.8 and 10.8.5). The build-in solution does a pretty good job, especially for LaTeX files. I do see words underlined in red, if ST2 thinks they contain a typo. But if I choose to "ignore" these words (no more highlighting then) and restart Sublime Text, they're highlighted again (same thing happens with ST3).
I'm not even able to find the list of ignored words and I somehow get the impression that ST seems to "forget" those words. I've tried to add a list manually in my Preference.sublime-settings file: no effect.
The "CheckBounce" plugin looks like a promising alternative, although LaTeX support is missing (most commands are highlighted as incorrect).
Any ideas?

See the section for ignored_words below. You need to manually add words to your preferences file. I've set the preferences files to hot-keys to have easy access.
/Users/HOME/Library/Application Support/Sublime Text 2/Packages/User/Preferences.sublime-settings
{
"auto_complete_triggers":
[
{
"characters": "./\\()\"'-:,.;<>~!##$%^&*|+=[]{}`~?",
"selector": "text.shtml"
}
],
"color_scheme": "Packages/User/lawlist.tmTheme",
"find_selected_text": false,
"font_face": "Courier",
"font_size": 18.0,
"forward_sync": true,
"ignored_packages":
[
"Vintage"
],
"ignored_words":
[
"Joinder",
"\\bf\\uline",
"\\begin{singlespace*}",
"\\end{singlespace*}",
"\\begin{tightcenter}",
"\\end{tightcenter}",
"\\begin{document}",
"\\end{document}",
"quotingsetup",
"renewenvironment",
"doublespace",
"flushright",
"minipage",
"pagestyle",
"uuline",
"textbf"
],
"inverse_cursor_state": true,
"keep_focus": false,
"scroll_past_end": true,
"show_full_path": true,
"word_separators": "./\\()\"'-:,.;<>~!##$%^&*|+=[]{}`~?"
}

It seems like the ignore_word command in your sublime does not add the word to the ignored_words list. I am currently using ST3 and it has the same problem. So I made a small plugin to make the context command ignore xxxxx adds a word to the ignored_words list in your user's preferences.sublime-settings.
Here is the repository: https://github.com/zcold/ignore_words
If you are using package control, just add a new repository and install the plugin named ignore_words.
If you do not use package control, just create a ignore_words folder in ${sublime}\data\packages\ and copy the file ignoreword.py from the mentioned repository into that folder.
I hope it solves your problem.

One way to solve this, is add the word by hand to the dictionary.
Locate the .dic file, in there you will see a big list of words with the follow format word/p [CAT=,G=,N=]
Those things after the word are features of the word (e.g proper name ,feminine,...)
Find a similar word and copy that part to your entry.
Save the file, restart your editor (to reload the dictionary) and you should be good to go :)

Related

How to disable sublime text 4 Context-Aware Suggestions

In sublime text 4, it will suggest context word, I want disable that feature.
for example, I type wh, I will get a "while snippet".
when file have "while" word, I type wh,I will get "while" word and "while snippet",I have to move down to select "while snippet".
"auto_complete_use_index": false, do not work.
Is there a way to disable the first "while" word.
If you don't want to inhibit word/buffer completions entirely, you can create a plugin like the following (Tools menu -> Developer -> New Plugin... and replace the placeholder with the following):
import sublime, sublime_plugin
class InhibitWordCompletionsEventListener(sublime_plugin.EventListener):
def on_query_completions(self, view, prefix, locations):
return sublime.CompletionList([sublime.CompletionItem.command_completion('', 'noop')], sublime.INHIBIT_WORD_COMPLETIONS)
Be sure to save it in the folder ST recommends (i.e. Packages/User/) with a .py extension.
Then, when you type wh, ST won't suggest the word while, just the Python snippet.
NOTE: this feels like a bit of a hack, it may not work this way in future builds of ST, but I tested on 4125 and it works there.
If you do want to disable buffer completions entirely, see How to remove words in the current buffer from Sublime Text 4 autocomplete list.
On my test for version 4121,I get the following results:
"auto_complete_include_snippets": false, --OK
"auto_complete_use_index": false, -- no work
"index_files": false, -- no work
Given this, you can try the setting:
"auto_complete_include_snippets"

Error in VS Code [Unable to write into user settings. Please open the user settings to correct errors/warnings in it and try again.]

While changing any setting in Visual Studio I'm getting an error like this:
Unable to write into user settings. Please open the user settings to correct errors/warnings in it and try again.
In the settings.json There is a problem as:
Expected Comma JsonC(514)
Error Code:
I suggest to validate your JSON in an online JSON validator like jsonlint for better info where the problem lies.
Also, as mentioned in this SO post and this SO post, that leading 0's on a number would also cause this kind of issue.
If you have a number, don't ever store it with leading zeroes. If you
have a value that needs to have a leading zero, don't treat it as a
number, but as a string. Store it with quotes around it.
Here is an example:
Invalid
{
"attribute": "// numeroConta",
"operator": "=",
"value": 0030152201
}
Valid
{
"attribute": "// numeroConta",
"operator": "=",
"value": "0030152201"
}
Please provide your settings.json if this is not the case.
One of the most common causes for this is presence of comments inside JSON file. While vscode itself loads config with json-with-comments format, the sync part fails and when you use the GUI to configure settings it fails to update the settings.json file, even if you will not see any error/warning reported on the file.
In my case, I had a comma at the end of the main curly brackets, but VS Code wasn't alerting to it specifically:
{
...
}, // <---
In my case I had to open settings.json and add , on the end of
{
"workbench.colorTheme": "Default Light+",
"workbench.colorCustomizations": {
"editorError.foreground": "#00000000",
"editorWarning.foreground": "#00000000",
"editorInfo.foreground": "#00000000"
},

Customize syntax highlighting colors of data types and variables for typescript in Visual Studio Code

I would like customize syntax highlighting colors for typescript.
I use Visual Studio Code 1.16 and custom theme (Actual) Obsidian.
I try use featues editor.tokenColorCustomizations.
Here is my custom user settings.
{
"editor.fontSize": 20,
"workbench.colorTheme": "(Actual) Obsidian",
"editor.tokenColorCustomizations": {
"functions": "#F1F1F1",
"keywords": "#8EC160",
"types": "#87CEEB",
"numbers": "#F1F1F1",
"variables": "#F1F1F1",
"textMateRules": [
]
}
}
I don’t know how can I select a change color of:
data types keywords (in the screenshot string, number, boolen)
variables (in the screenshot : filtredProducst)
in the screenshot: OnInit
You're on the right track.
As you've seen, editor.tokenColorCustomizations can be used to set broad classes of tokens like "keywords", etc. The exact set of things that can be customized this way does not appear to be documented, but you can refer to the source code for ITokenColorCustomizations.
Then there is the textMateRules section. This can be used to specify things that the "simple" method cannot. The documentation explains the basic idea, but a screenshot may help to illustrate:
First, use the command palette (Ctrl+Shift+P) to run "Developer: Inspect TM Scopes". This pops up a window that will show the sequence of scope labels for any token.
Edit 2020-07-24: As of VSCode 1.47 (and possibly a little earlier) the command is called "Developer: Inspect Editor Tokens and Scopes".
Next, add an entry to textMateRules where the scope specifier matches the stack of scope labels. The matching rules are somewhat complicated but mostly intuitive; you'll probably get it pretty quickly just by experimenting. Changes to the rules take effect as soon as you save settings.json.
Note: VSCode does not appear to completely or correctly implement the TextMate matching rules. It's close, but that's it. (Examples: VSCode does not implement exclusion with "-", and its resolution of "a c" versus "b c" seems incorrect.)
For the specific elements in your question:
Data types can be matched with support.type.primitive
filteredProducts can be matched with variable.other.property
OnInit can be matched with entity.other.inherited-class
Example (that just makes them all red):
"textMateRules": [
{
"scope": [
"support.type.primitive",
"variable.other.property",
"entity.other.inherited-class",
],
"settings": {
"foreground": "#F00",
},
},
],

Visual Studio Code autocomplete for words in same file

[Note: I've already tried javascript.suggest.alwaysAllWords as proposed here, but the suggested settings just give me Unknown configuration setting in Code 1.8.1 for macOS.]
Autocomplete works fine for me in Visual Studio Code, but only for code in outside modules. That's great for what it's worth, but I'm really missing the buffer-based autocomplete from Sublime which essentially includes any word in a currently-open buffer as an autocomplete option.
For example, when I type this:
hashToPage : String -> Page
hashT
I want autocomplete to offer up oPage as a completion for hashT. Instead, I have to retype the entire string.
Is there a way to tweak the settings to include words from the current page?
(Or all open buffers, or any approach that indexes variable and function names that I've created?)
Searching the internet I found the following option:
"editor.quickSuggestions": {
"other": true,
"comments": false,
"strings": false
},
Fix like this and that worked for me correctly:
"editor.quickSuggestions": {
"other": true,
"comments": true,
"strings": true
},

Snippets where content is conditional on language in Sublime Text 3?

Is there a way to create a single snippet file where the content output is dependent on the language? For example, keyboard shortcut x outputs "abc" when used in a css file, but "def" when used in a javascript file?
Snippets don't contain much processing capability — you can perform substitutions in them via Boost-style regexes and format strings, and they have access to a number of environment variables within Sublime such as the current file's name, the line number, etc., but beyond that they don't have much programmatic processing capability. It might be possible to set up a series of regexes that try to case-insensitively match $TM_FILENAME against \.css$ and output abc, then immediately match $TM_FILENAME against \.js$ and output def - only one of them will be successful.
However, in my mind such processing is much more easily handled by a plugin written in Python. The API documentation is mostly complete (all the functions you'll need are documented there) and there are a ton of examples around the net to learn/borrow from. Here's a quick example:
import sublime_plugin
class PrintScopeCommand(sublime_plugin.TextCommand):
def run(self, edit):
pos = self.view.sel()[0].begin()
scope = self.view.scope_name(pos)
if 'source.js' in scope:
self.view.insert(edit, pos, "This is JavaScript!")
elif 'source.css' in scope:
self.view.insert(edit, pos, "This is CSS!")
Save the file in your Packages/User directory (accessible via Preferences -> Browse Packages...) as print_scope.py. Next, assign it to a key binding by opening your user keymap (Preferences -> Key Bindings-User) and adding the following:
[
{ "keys": ["ctrl+alt+shift+p"], "command": "print_scope" }
]
if the file is empty. If you already have other custom key bindings, just add a comma , after the last one, then paste the line above after it, before the closing square bracket ].
You should now be able to hit CtrlAltShiftP (or whatever other key binding you choose), and if the file's syntax is set to JavaScript it will insert the This is JavaScript! message at the current cursor position. If the syntax is set to CSS, This is CSS! will print, and if the syntax is anything else, then nothing will print.

Resources