Lua extension in vscode suddenly adding stuff to my code - visual-studio-code

I am using the sumneko extension for lua in vscode.
I was editing the settings.json to try to stop autocomplete in comments, but somewhere in the process, I messed something up, and now in my code I am seeing extra words, such as:
require 'utils'
becomes:
require modname:'utils'
I'm also seeing :table, :integer, :string, etc, so it looks like the highlighter is analyzing the status of function arguments, and adding that as text. I'd love if it changed the color, rather than adding the text, but I've yet to find any setting that looks like it would do that.
The new characters do not copy, so are display only, I suppose. They seem like useful information, and I wonder if they are supposed to be showing up as highlighting instead?? That would be nice! But still they are very confusing to see in my code... I am using the default dark theme.
Can someone tell me what setting I inadvertently turned on? Also, I am still getting auto-complete in comments, despite turning it off. I'm also seeing word completion, although the delay seems to work. I don't know if the issues are related. Can you see anything wrong in my settings file? It is not showing any syntax errors.
Here is the settings.json file:
"editor.acceptSuggestionOnCommitCharacter": false,
"editor.quickSuggestions": { "other": false, "comments": false, "strings": false },
"editor.quickSuggestionsDelay": 1000,
"editor.wordBasedSuggestions": false,
"editor.semanticHighlighting.enabled": true,
"Lua.workspace.library": {
},
"explorer.confirmDelete": false,
"git.confirmSync": false,
"diffEditor.renderSideBySide": true,
"git.enableSmartCommit": true,
"Lua.awakened.cat": false,
"Lua.completion.callSnippet": "Both",
"files.trimTrailingWhitespace": true,
"workbench.enableExperiments": false,
"workbench.sash.size": 6,
"workbench.startupEditor": "newUntitledFile",
"Lua.hover.viewNumber": false,
"Lua.hover.viewString": false,
"Lua.intelliSense.searchDepth": 10,
"Lua.completion.workspaceWord": false,
"Lua.diagnostics.workspaceDelay": 1000,
"Lua.diagnostics.workspaceRate": 70,
"Lua.hover.previewFields": 20,
}
and here is the workspace settings.json file, in case that matters:
{
"Lua.diagnostics.globals": [
"gfx",
"reaper",
"GetRGB",
"RandomColor",
"MButtonPanel"
],
"Lua.diagnostics.disable": [
"unused-function",
"undefined-global",
]
}

Okay, I discovered the developer's github site had a q&a forum, and he answered the question about the display-only items. It was a setting, with a non-obvious (to me!) name:
hint:param type
that mysteriously got turned on...
Just in case someone else comes here looking.

I am going to make the assumption that those contextual "display only" items are a feature and you won't be able to change that.
However, worst case you can always go into the C:\Users\YOU\.vscode\extensions\TheLuaExtension\ folder and edit the package.json file to read like you have above...
"editor.quickSuggestions": { "other": false, "comments": false, "strings": false },
My point is, the information is coming from somewhere, if it is ignoring your personal settings, then change the definition it is using.

Related

VSCode editor.semanticTokenColorCustomizations setting doesn't apply

No matter what I've tried, nothing is being applied to the color customizations. What am I missing? This really shouldn't be as complicated as it is.
The below snippet is just the latest attempt. I've tried 20 other variations of this, along with various themes, not specifying a theme, this ridiculous enabled property in both scopes or not. I've tried different rule properties, based on the Textmate scopes, ones that aren't defined, others that are.
I've restarted VSCode maybe 50x through this process as well.
These settings are being applied on the user settings.json. There is no other matching definition in the workspace, or the same user settings file.
"editor.semanticHighlighting.enabled": true,
"editor.semanticTokenColorCustomizations": {
"enabled": true,
"[Tomorrow Night]": {
"enabled": true,
"rules": {
"storage.type.class.php": {
"foreground": "#333333"
}
}
}
},

VSCode Code Spell Checker extension - Include TXT files

I'm using the VSCode Code Spell Checker, and I wish to detect typos in TXT files. But the issue is, that I want to detect it on TXT files that are being ignored for search by the VSCode.
Here is my settings.js file:
{
"cSpell.words": [
"BING",
"DOGPILE"
],
"search.exclude": {
"**/.vscode": true,
"**/dist": true,
"**/misc": true,
"**/misc/documents": true,
"**/misc/": true,
"/misc/": true,
"misc/**": true,
"**/misc/**": true,
"**/misc/documents/**": true,
"**/node_modules": true,
"**/sources": true
},
"eslint.validate": [
"javascript"
],
"http.proxy": "",
"http.proxyAuthorization": null,
"http.proxyStrictSSL": false,
"editor.renderWhitespace": "none"
}
The file that I want to detect typo located inside the misc directory, that is declared in the "search.exclude" list (I don't want search results from any files in this directory), but I DO WANT to detect typos on theses files.
If I remove all of theses and the settings.js looks like that:
{
"cSpell.words": [
"BING",
"DOGPILE"
],
"search.exclude": { },
"eslint.validate": [
"javascript"
],
"http.proxy": "",
"http.proxyAuthorization": null,
"http.proxyStrictSSL": false,
"editor.renderWhitespace": "none"
}
The TXT file typo detection works, but I get the search results that include files inside the misc directory, which is NOT what I want.
Has anyone faced this issue before and know how to solve it?
Thanks.
as it is explicitly stated in Spell Checker FAQ
What files are excluded by the spell checker?
By default the spell checker excludes the same files excluded by the VS Code search.exclude setting. See discussion: #16, #55 and #95
the correct way to address the problem exposed in the question I would say is to open an issue to the project for a new feature request to allow to override this default behavoir.
as a last resort if you absolutely need to prevent search.exclude from being added to the exclusions you could try to force the code installed on your machine and after restarting vscode you will have the spell check working also in those paths.
DISCLAIMER please note what is illustrated below is a discouraged hack mentioned in here for informational purposes only, obviously if you try this kind of workaround you must be extremely aware of what you are doing
for example:
assuming the extension was installed in ~/.vscode/extensions/streetsidesoftware.code-spell-checker-1.10.2
in the source server/config/documentSettings.js there is the function async fetchSettingsFromVSCode(uri) where it is added :
ignorePaths: ignorePaths.concat(CSpell.ExclusionHelper.extractGlobsFromExcludeFilesGlobMap(exclude)),
by changing in to
ignorePaths: ignorePaths
then quit fron vscode and when re-open it the extension no longer excludes the same files excluded by the VS Code search.exclude setting.

Visual Studio Code: How to Disable `editor.codeActionsOnSave`

I find that the editor.codeActionsOnSave configuration very annoying because a lot of times when I save, it eats up some time getting some code actions for the language I'm currently using (Golang, for example).
I have no desire nor need for such a feature as I have configured my desired actions upon save elsewhere.
I have already added the following entries on my VS Code configuration file:
"editor.codeActionsOnSave": {},
"[go]": {
"editor.codeActionsOnSave": {}
},
However, setting an empty value does not seem to disable this annoying feature because I still get popups that VS Code is getting some code actions.
Previously, editor.codeActionsOnSave was set to null by default, but this also does not disable the feature.
How do I disable this feature?
EDIT: I also filed a GitHub issue about this here.
You can delete it or set it to false
...
"editor.codeActionsOnSave": {
"source.fixAll": false,
"source.organizeImports": false
},
"editor.formatOnSave": false
...
I managed to get rid of it by setting it only for go :
"[go]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": true
}
}
Setting it to null does not work, somehow Go expects it to be set up, and setting it to false globally can be a pain on other projets (I am looking at you react-native project with eslint set up)

Am I understanding this VS Code API behavior correctly? Non-default *object* settings (when provided) are always merged?

I'm working on a VS Code Extension, and I think maybe I'm missing something in the docs, or else the behavior I'm seeing just isn't specified there, and my assumptions are wrong...?
I've defined some default settings for my extension, like so...
package.json
"contributes": {
"configuration": {
"title": "ToggleSettingsChanges",
"properties": {
"toggleSettingsChanges.settingsToToggle": {
"scope": "resource",
"type": "object",
"default": {
"window.zoomLevel": 2,
"editor.fontSize": 22,
"terminal.integrated.fontSize": 16,
"scm.diffDecorations": "none",
"workbench.statusBar.visible": false,
"editor.cursorBlinking": "solid",
"workbench.activityBar.visible": false
},
"description": "[ snip ]"
}
}
}
},
extension.js
// In the "main" method that runs when a command is activated:
const config = vscode.workspace.getConfiguration("toggleSettingsChanges");
const settingsToToggle = config.get("settingsToToggle");
const inspectedSettingsToToggle = config.inspect("settingsToToggle");
console.log("settingsToToggle:", JSON.stringify(settingsToToggle), "\n\n")
console.log("inspected settingsToToggle:", JSON.stringify(inspectedSettingsToToggle), "\n\n")
return;
In the Extension Host instance, I can tweak and adjust the settings, to include this:
User or Workspace Settings JSON
// ...
"toggleSettingsChanges.settingsToToggle": {
"editor.fontSize": 11,
"pumpkins_are_great": true
},
In the console output, I'm seeing the following:
settingsToToggle: {"window.zoomLevel":2,"editor.fontSize":11,"terminal.integrated.fontSize":16,"scm.diffDecorations":"none","workbench.statusBar.visible":false,"editor.cursorBlinking":"solid","workbench.activityBar.visible":false,"pumpkins_are_great":true}
inspected settingsToToggle: {"key":"toggleSettingsChanges.settingsToToggle","defaultValue":{"window.zoomLevel":2,"editor.fontSize":22,"terminal.integrated.fontSize":16,"scm.diffDecorations":"none","workbench.statusBar.visible":false,"editor.cursorBlinking":"solid","workbench.activityBar.visible":false},"globalValue":{"editor.fontSize":11,"pumpkins_are_great":true}}
For the settingsToToggle line, I expected to see only the following settings:
{"editor.fontSize":11,"pumpkins_are_great":true}
It seems that if you provide an object default, any configuration provided is merged with that object, instead of replacing it entirely.
Is that the case? Have I missed this in the documentation?
It seems to me that a value (even an object) would be overwritten, and not simply merged.
The documentation may have been updated since this question was posted. The way it's written now, seems pretty clear to me. I'm writing because I feel I have found a discrepancy in the API, which may help out the OP.
Reference
Note: Only object value types are merged and all other value types are overridden.
-- VS Code API - WorkspaceConfiguration
Additional information
I want my default values to be merged with the user settings, as is described above. I was confused by seeing my defaults overriden. This question helped me understand what is happening. I'll share my approach since OP may be interested. My observations:
Default values provided in package.json are merged with user settings, as described in the documentation (link above).
Default values passed programmatically with WorkspaceConfiguration.get(section, defaultValue) do not exhibit the merging behavior. It's not clear if this is intentional or not. Update: this behavior is working as intended, reference #105598.

Prevent autocomplete in Visual Studio Code

I'm using the new Visual Studio Code.
In a SQL file, any time you type case, it automatically adds end, as if you were building a case block. Even if you're in a comment, or using Case as part of a word (for example, select CaseID from...).
I'd like to disable all of that nonsense completely, since it doesn't do a good job of auto completing things for me.
The only configuration options I can find, I've already set:
"editor.autoClosingBrackets": false,
"editor.suggestOnTriggerCharacters": false,
What else can I do to stop this?
It is also true for things like begin (it adds end), and I'm sure lots more.
In the most recent version of Visual Studio Code I've found out that the
"editor.acceptSuggestionOnCommitCharacter": false
configuration disables this behavior.
By 2016, Visual Studio Code is pretty cool and ready for prime time. But I still haven't found a way to simply turn off autocompletion completely.
But they do have some things in their documentation:
Customizing IntelliSense
Basically, I put this in my settings.json to try and turn it off for the workspace. But I still have to evaluate this.
// Place your settings in this file to overwrite default and user settings.
{
// Controls if quick suggestions should show up while typing
"editor.quickSuggestions": { "other": false, "comments": false, "strings": false },
// Controls if suggestions should be accepted with "Enter" - in addition to "Tab". Helps to avoid ambiguity between inserting new lines and accepting suggestions.
"editor.acceptSuggestionOnEnter": "off",
// Controls the delay in ms after which quick suggestions will show up.
"editor.quickSuggestionsDelay": 10,
// Enable word based suggestions
"editor.wordBasedSuggestions": false
}
This works for me as of 2019-May-17.
"editor.acceptSuggestionOnCommitCharacter": false,
"editor.acceptSuggestionOnEnter": "off",
"editor.hover.enabled": false,
"editor.minimap.enabled": false,
"editor.parameterHints.enabled": false,
"editor.quickSuggestions": false,
"editor.quickSuggestionsDelay": 10,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"editor.suggestOnTriggerCharacters": false,
"editor.wordBasedSuggestions": false,
This isn't the correct answer, but it might be an even better option. Increase:
Editor: Quick Suggestions Delay
from 50 ms (default) to 500-1000 ms.
In this case, you'll have half a second to beat the autocomplete option, which may be enough for 95% of the time, and you won't lose the functionality that you might want in some cases.
In the current version of Visual Studio Code, add this to your user settings:
"editor.quickSuggestions.other": false
This disables most of the spurious suggestions.
Add this to settings.json
"editor.suggestOnTriggerCharacters": false,
Here is up to date solution:
"editor.suggest.showClasses": false,
"editor.suggest.showColors": false,
"editor.suggest.showConstants": false,
"editor.suggest.showConstructors": false,
"editor.suggest.showCustomcolors": false,
"editor.suggest.showDeprecated": false,
"editor.suggest.showEnumMembers": false,
"editor.suggest.showEnums": false,
"editor.suggest.showEvents": false,
"editor.suggest.showFields": false,
"editor.suggest.showFiles": false,
"editor.suggest.showFolders": false,
"editor.suggest.showFunctions": false,
"editor.suggest.showInterfaces": false,
"editor.suggest.showIssues": false,
"editor.suggest.showKeywords": false,
"editor.suggest.showMethods": false,
"editor.suggest.showModules": false,
"editor.suggest.showOperators": false,
"editor.suggest.showProperties": false,
"editor.suggest.showReferences": false,
"editor.suggest.showSnippets": false,
"editor.suggest.showStructs": false,
"editor.suggest.showTypeParameters": false,
"editor.suggest.showVariables": false,
"editor.suggest.showValues": false,
"editor.suggest.showWords": false,
"editor.suggest.showUsers": false,
"editor.suggest.showUnits": false,
// controls bracket auto closing
"editor.autoClosingBrackets": "never",
// controls specific languages tag auto closing
"html.autoClosingTags": false,
"javascript.autoClosingTags": false,
"typescript.autoClosingTags": false
I disabled mine by going to Settings > Text Editor > Suggestions > Inline Suggest: Enabled and unticking the box.
(Update) This is overwritten by the language settings, so you have make a new more changes. This post shows how to disable suggestions for Plain Text, but you can follow the steps to change the setting for all languages. How to disable visual studio code dropdown suggestions in plain text files
Disable "Visual Studio IntelliCode" extension while working on SQL files. This might be a better option than changing settings that are useful for other files.