I use VS Code (Windows 11, version 1.74.3) mainly for TypeScript. I have excluded node_modules from searches in files.exclude and search.exclude. Indeed, with a Ctrl-Shift-F I don't see anything from node_modules. Perfect.
But if in the command palette I enter, for example, #error I see also all error symbols from packages. This could be useful sometimes, but clutter the resulting list of symbols. Is there a way to have # excludes node_modules?
Thanks for clarifying!
mario
Related
I'm switching from vscode to neovim (currently using lunarvim). One problem bothered me most is that if my included file don't use relative path, but handle these dependencies in Makefile instead, then the lsp failed to navigate, and make linter report mistakes because some definitions and declarations are in other files and can't be located.
I face the same situation in vscode too, but by writting c_cpp_properties.json file, the intellisense will work normally.
If there is any way to write down some hints for neovim lsp? Or maybe if there is some plugin that can auto detect the Makefile or CMakeList file and solve the problem?
I met strange behavior of pylint in VS Code. '.pylintrc' doesn't recognize after recreating.
My steps:
Install pylint in VS Code
Set pylint as linter using 'Python: Select linter' command
Add '.pylint' with disabling some of warnings:
[MESSAGES CONTROL]
disable=missing-function-docstring,
missing-final-newline,
missing-class-docstring,
missing-module-docstring,
invalid-name,
too-few-public-methods
And it works fine! But then I tried to set pylint configuration in 'pyproject.toml':
[tool.pylint.messages_control]
disable = ["missing-function-docstring",
"missing-final-newline",
"missing-class-docstring",
"missing-module-docstring",
"invalid-name",
"too-few-public-methods"
]
After that exluded warnings shows again.
Ok, I deleted 'pyproject.toml' and return '.pylintrc' - no effect. I tried to select linter again, reopen VS Code, reinstall pylint, but nothing helps.
Version: 1.70.0 (user setup)
Commit: da76f93349a72022ca4670c1b84860304616aaa2
Date: 2022-08-04T04:38:16.462Z
Electron: 18.3.5
Chromium: 100.0.4896.160
Node.js: 16.13.2
V8: 10.0.139.17-electron.0
OS: Windows_NT x64 10.0.19044
pylint version 2.15.0
Two things:
Configuring pylint via pyproject.toml is indeed a hassle, because this specific file only gets respected if pylint is run from precisely that directory. Many IDEs however (Spyder at least, but it seems PyCharm is similar) apparently always run pylint from the respective subdirectory, i.e. from the folder that directly contains the file undergoing linting. Thus, your pyproject.toml isn't respected in these cases. (If you find this behavior weird, you're not the only one, but that's how pylint currently does it.) So this is the underlying reason for the errors in your screenshot. On the other hand, any .pylintrc in the project does indeed get respected even when pylint is run from inside a subdirectory. So for now I would indeed recommend configuring pylint by a .pylintrc in your project and not by pyproject.toml. (I think there is some option whereby one can make .pylintrc just point to the pyproject.toml, which would then hold all the concrete configuration and would be respected even from subdirectories – this would then be the best solution for the time being.)
To resolve your issue that remains with .pylintrc: Tell pylint to show you the path of the configuration file which it uses when it's called. For this, use the command line: cd into the directory in question and run pylint in verbose mode: pylint --verbose. This shows you what config file is being used. (For instance, you might have a long-forgotten pylintrc or .pylintrc sitting around somewhere in your home directory that gets loaded.)
By the way, this trick – using verbose mode to see what configuration file is actually being used – is useful with many tools.
There are several questions here on indenting code in visual studio code (How do you format code in Visual Studio Code (VSCode)?), and on indenting OCaml code (How to indent existing OCaml code), but none of the answers work for indenting OCaml code in visual studio code.
I have installed the OCaml Platform visual studio code extension, vscode-ocaml-format (following https://dev.realworldocaml.org/install.html), ocaml-lsp-server (following https://ocaml.org/learn/tutorials/up_and_running.html) using opam, updated and upgraded everything, used eval $(opam env), but this still does not work. I'm a bit at a loss...
It is very hard to answer such questions as we need more debugging input from your side. On the other hand, it is so hard to get it from vscode so it is better just to walk you through the whole process from the very beginning to see where things might go wrong. I would suggest you follow the process for ease of debugging. After you have everything working you can adapt it to your particular setup.
Create a fresh new folder and put some OCaml file into it, let's name it test.ml and let's put into it the following code,
let test = [
"hello"
]
Now create a fresh local opam switch, by issuing in the same folder as the test.ml file the following command, (note the dot at the end of the command, it is required, it will create a local switch for you)
opam switch create .
Next install the required dependencies.
opam install ocamlformat ocamlformat-rpc ocaml-lsp-server
Create the .ocamlformat file in the same folder as the test.ml file. It will tell ocamlformat that you want to be ocamlformatted and you can use this file to setup your preferences.
Make sure that you have installed ocamlplatform for vscode
Now we are ready for the test. Start vscode and open test.ml. It will ask you to select the sandbox. Select the sandbox that corresponds to the folder where you put test.ml (it should be marked as local and have the same name as the folder name, and there will be the full path to it, so it will be easy for you to find it). The code syntax should be highlighted and there should be no error messages from vscode. Finally, hit Ctrl-Shift-I to re-indent your file, it should transform your code to,
let test = [ "hello" ]
This command won't work for me. I had installed the Visual Studio Keymap, but when I uninstalled that it made no difference. If I open Keyboard Shortcuts and try customizing it to some other keybinding, still nothing. I open the simplest javascript folder/file (folder with a single .js file) to test, simply putting the cursor on either side of the parens in console.log('hi');
Version is 1.28.2 (latest). The only other extensions I have installed are Debugger for Chrome & ESLint.
editor.action.jumpToBracket is what you want for .js files, Ctrl-Shift-\.
The "Go to matching pair" command: editor.emmet.action.matchTag is for html files.
If I open some files in Visual Studio Code (e.g. code some_path/some_file.py some_other_path/some_other_file.py) it seems that Find in Files and Go to File doesn't work.
If I search for some text only the file in the currently active tab is included. Only if I select other tabs once those files are then also considered if I repeat the search.
Also other files do not appear in Go to File unless I give those tabs the focus at least once and they populate the list because they are "recently opened".
I am not opening a folder with files in it.
In SublimeText Find in Files can do this. Or I let :vimgrep search all buffers in Vim.
How would I do this with VS Code?
I often search a large code base (organized in multiple repositories and paths) with ack or ripgrep and feed a list of files to the editor. E.g. code $(rg --files-with-matches 'some feature' **/test*.py).
My system:
code --version
1.11.1
d9484d12b38879b7f4cdd1150efeb2fd2c1fbf39
> sw_vers
ProductName: Mac OS X
ProductVersion: 10.12.4
BuildVersion: 16E195
You mentioned "I am not opening a folder with files in it." I think that you will find these work if opening a folder.