[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
},
Related
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"
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"
},
Background
I have the following snippet in a composer.json file:
"extra": {
"magento-force": "override"
}
Using Chef, I'd like use a ruby_block to replace this content with:
"extra": {
"magento-force": "override",
"patches-file": "m2-hotfixes/patches.json"
}
Question
What's the best way to achieve this using ruby so that I retain the proper indentation and spacing, etc? The gsub examples I have seen would result in everything on a single line which is not what I want. (E.g. if I searched for: /"magento-force/": /"override"/ and then replaced it with /"magento-force/": /"override"/, /"patches-file/": /"m2-hotfixes/patches.json/", I'd likely get something like:
"extra": {
"magento-force": "override", "patches-file": "m2-hotfixes/patches.json"
}
Turns out the best way to achieve the exact task I want is to use composer itself. Using this in an execute resource gets me exactly what I need:
config extra.patches-file m2-hotfixes/patches.json
That said, I won't consider this a pure answer to the question posed.
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",
},
},
],
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 :)