Disable predefined filename - JSON schema association - json

I am using Visual Studio Code 1.60.1.
In my project I use many files called project.json and have created my custom JSON schema for them.
When I specify my schema via $schema field directly in project.json everything works just fine.
But I want to use .vscode/settings.json file for that:
{
"json.schemas": [
{
"fileMatch": [
"data/projects/list/*/project.json"
],
"url": "./.vscode/schemas/project.json"
}
]
}
This works too BUT in this case it appears that VS Code is mixing two schemas for my file, which is showing in a tip when I hover the opening { in editor:
JSON schema for .NET Core project.json files
[My scheme name]
This results in mixing properties and messed up hints and autocomplition suggestions.
How can I disable VS Code default ".NET Core" schema for my files and leave only my schema?

Turns out I had C# official extension installed.
I disabled it and everything is working just fine!
The moral is: if something goes wrong, don't forget to check your extensions!

Related

module pygame has no init member pylint [duplicate]

This is the code I have:
import pygame
pygame.init()
I'm very confused because if I try to run the file, then there seems to be no issue, but pylint says the following:
E1101:Module 'pygame' has no 'init' member
I have searched thoroughly for a solution to this "error". In every relevant case I found, the solution was to make sure that I have not made another file or folder with the name "pygame", because in that case, I would just be importing my own file or folder.
However, I have not made a folder or file with a name even close to "pygame", so I don't know what the problem is.
As said earlier, it seems like I'm able to run the file without any issues and having errors like this confuses me in my learning process.
I write code in Visual Studio Code, I'm using python 3.6, I'm using pygame 1.9.3 and have updated my pylint. Any help would be appreciated.
Summarizing all answers.
This is a security measure to not load non-default C extensions.
You can white-list specific extension(s).
Open user settings and add the following between {}:
"python.linting.pylintArgs": [
"--extension-pkg-whitelist=extensionname" // comma separated
]
You can allow to "unsafe load" all extensions.
Open user settings and add the following between {}:
"python.linting.pylintArgs": [
"--unsafe-load-any-extension=y"
]
If you have VS code, go in your .vscode folder > settings.json or search for python.linting.mypyArgs Under user settings tab paste inbetween curly braces
"python.linting.pylintArgs": [
"--extension-pkg-whitelist=lxml" // The extension is "lxml" not "1xml"
]
I no longer see the pyinit error.
I had the same issue when I started using Visual Studio Code with Python. It has nothing to do with having another pygame.py or not installing it properly. It has to do with the fact that Visual Studio Code takes your code literally, and since you cannot import pygame.init(), it thinks that it isn't a correct module.
To fix this, open up settings.json (go into your settings, and click the {} icon) and paste
"python.linting.pylintArgs": [
"--extension-pkg-whitelist=pygame"
]
to it.
I had the same issue with one of my modules. This is what I did to resolve the problem. (I'm using visual studio on windows 10)
Press CTRL+SHIFT+P in visual studio
Choose "Preferences: Open Settings (JSON)"
Add "python.linting.pylintArgs": ["--generate-members"] below one of the lines (put a comma if necessary)
Save the .json file (CTRL+S)
For me, the code looks like this :
{
"breadcrumbs.enabled": false,
"editor.minimap.enabled": false,
"python.pythonPath": "C:\\Users\\xxx\\Anaconda3",
"terminal.integrated.rendererType": "dom",
"window.menuBarVisibility": "default",
"workbench.activityBar.visible": false,
"workbench.statusBar.visible": true,
"python.linting.pylintArgs": ["--generate-members"], //line to add
"[json]": {
}
}
Hope it helps.
Credit to #Alamnoor on github
This answer includes the answer to your question. In short it explains:
Pylint imports modules to effectively identify valid methods and attributes. It was decided that importing c extensions that are not part of the python stdlib is a security risk and could introduce malicious code.
and as a solution it mentions, among others:
Disable safety using the .pylintrc setting unsafe-load-any-extensions=yes.
See here for more information about pylint.rc. Quickest method is to just create the file .pylintrc in your project directory or your home directory.
I found adding this in settings.json() solves the problem.
"python.linting.pylintArgs":[
"--extension-pkg-whitelist=pygame",
"--erros-only"
]
I find an answer and it really works for me.
See the accepted answer and change it to extension-pkg-whitelist=lxml
pylint 1.4 reports E1101(no-member) on all C extensions
I recommend going to the view tab, clicking command palette and searching preferences: open settings.json. Then add a comma on the last line of code.Below that paste this:
"python.linting.pylintArgs": [
"--extension-pkg-whitelist=extensionname" // comma separated
]
Then save your document (ctrl + s).
Check if you have a python file named pygame.py created by you in your directory. If you do, then the import pygame line is importing your own file instead of the real Pygame module. Since you don't have an init() function in that file, you're seeing this particular error message.
I found a solution, modifying the most voted answer:
"python.linting.pylintArgs": [
"--extension-pkg-whitelist=pygame"
]
Replaced the "lxml" with "pygame".
Disable Pylint
1.Press ctrl + shift + p
2.Then type Disable Pylint
If you are using vscode then you can go to settings:
python.linting.pylintEnabled = False
It will fix the problem. If you aren't using vscode then you can go the command prompt and manually uninstall pylint with the command
pip uninstall pylint.

Very odd Cordova/Phonegap JSON error: Unexpected token in JSON at position 0

So i've been developing an app for the past few weeks. I have never messed with any json file whatsoever. Today I tried to run my app and it shows a very odd error from Cordova, Error:
Error: Unexpected token in JSON at position 0
The token is ' '?
Which JSON file is it? I went over all the main Json package files, and all of them started with the 0'th token as a '{'.
I'm completely lost, I didn't do anything at all, I didn't add a plugin or something that day it just appeared out of no where.
I have no idea which json files to attach here, there are dozens of them in the project directory.. Any ideas or direction will be extremely helpful, thanks.
Check plugins/*.json
There's most likely an issue hiding in one of those files.
For me it was an unresolved merge conflict inside fetch.json
Run npm install and it will give you more details of the error. In my case, it was an extra comma in package.json. It is a painful bug and I wish cordova explicitly mentioned where this issue was!
You had to check the file fetch.json in Plugins folder. Fetch.json must be encode in UTF8 and at the end of the JSON, the file need to finish correctly, without a comma, like this :
{
"es6-promise-plugin": {
"source": {
"type": "registry",
"id": "es6-promise-plugin#^4.1.0"
},
"is_top_level": false,
"variables": {}
},
"cordova-plugin-nativestorage": {
"source": {
"type": "registry",
"id": "cordova-plugin-nativestorage#^2.3.2"
},
"is_top_level": true,
"variables": {}
} //No Comma
}
Good luck !
My approach to any JSON error:
[optional] Remove/uninstall all plugins
Delete all your platform directory folders (ie. browser, Android, iOS etc,), and delete the package.json file
Note: Don't delete the package-lock.json file
Create a new package.json file by running npm init on your command line (run this command on your Cordova project directory).
Make sure you create this file with the same package name you used before. If you don't remember, you can check the config.xml file (including the 'version').
Reinstall all your plugins (if you followed step 1).
Add your platforms.
Run, build your Cordova project.
If it fails, follow step 1 to the last step.
It works 100℅
If this doesn't work, contact me and send me your issues.

Multiple Aurelia Apps Side by Side

I'm currently tasked with building 2 UI's for a service I've constructed.
The output from both of these UI's will need to end up in the same root folder.
I found the section that names the basic bundles in the "aurelia.json" file, and renamed the bundles created for my project, when built, my project as expected created 2 new bundles in the scripts directory with the new names.
However, upon running my project, I then found that index.html was getting a 404 trying to load the "vendor-bundle" (Which I had renamed to 'service-vendor-bundle').
No problem there, I just edited index.html to reference the new file, and bingo, 404 resolved.
The problem is however, that "service-vendor-bundle" can now not load "service-app-bundle".
I assumed (Probably incorrectly) that, when I renamed the bundles in my aurelia.json file, that the build output would also be configured appropriately to load the files in.
I need to be able to customize this beacuse once the 2 aurelia apps are finished, they will need to share a scripts folder, so I'll need
uione.html to load "scripts\uione-vendor-bundle.js" and "scripts\uione-app-bundle.js"
and I'll need
uitwo.html to load "scripts\uitwo-vendor-bundle.js" and "scripts\uitwo-app-bundle.js"
The final file layout once on the server will look something like the following:
root
uione.html
uitwo.html
scripts
uione-vendor-bundle.js
uione-app-bundle.js
uitwo-vendor-bundle.js
uitwo-app-bundle.js
images
*.png
Both client apps have to be developed separate from each other and be stand alone, so I can't combine them into one app, and I cant put them into seperate folders as the service that will be serving them is a custom in house built service, specifically configured to only serve from a single folder, with a single scripts and images folder.
My aurelia.json file currently looks like this:
.........
"plugins": [
{
"name": "text",
"extensions": [
".html",
".css"
],
"stub": true
}
]
},
"options": {
"minify": "stage & prod",
"sourcemaps": "dev & stage"
},
"bundles": [
{
"name": "uione-app-bundle.js",
"source": [
"[**/*.js]",
"**/*.{css,html}"
]
},
{
"name": "uione-vendor-bundle.js",
"prepend": [
"node_modules/bluebird/js/browser/bluebird.core.js",
"node_modules/requirejs/require.js"
],
..........
and I'm using the Aurelia cli tool (au ...) for my Aurelia based tasks.
Any pointers on how to achieve this would be great.
I think you're on the right track by customizing the bundle names.
What you can do is manually load both the vendor bundle and the app bundle. That way the app modules are already downloaded and ready to use, instead of letting the vendor bundle try to download it manually.
index.html
<body aurelia-app="main">
<script src="scripts/my-special-vendor-bundle.js" data-main="aurelia-bootstrapper"></script>
<script src="scripts/my-special-app-bundle.js"></script>
</body>
I have tested this and it is working fine for me. I am using this manual loading technique in my own project to allow ASP.Net script versioning to provide cache-busting (see my answer here).

Error in sencha architect localization(Extjs 5)

Am very new to sencha architect. I need to do localization in sencha architect. Using extjs 5, I refer http://docs.sencha.com/extjs/5.0/core_concepts/localization.html document.
And trying without Sencha Cmd.
Getting error as localhost/projectname/js/pt_BR.js file not found. Not able to get any working examples.
ext-all and ext-locale-es if any updating as mentioned above inindex.html. Its not able to fetch js from the path. so i gave exact path location for both js files.
Please let me know whats the mistake am doing.
Got It
Add "requires": ["ext-locale"] in app.json in created project file.
Add the preferred language "locale": "es" in app.json out side requires
Should not preview the project. Need to create a build. Click build web app in tool bar.Before that click build setting and set the path to save the files. Once clicking buil web app. App will be builded in specified path.
All the default stings will be changed to mentioned language. (In app.json we mentioned "locale": "es" spanish language.)
default strings like ok button, date picker, etc. Labels will not be updated with app.json language we need to add labels plugin.

How to set sublime-text to always show auto-complete suggestions

The code completion feature works really well when I type Java code, but I've recently made a build system for Modula-2, and while the auto-complete works when I press ctrl+space, it doesn't suggest the words on it's own. I have to hit ctrl+space every time, which (kind of) defeats the purpose.
I realize that modula-2 is not a very popular language, but sublimetext has a nice feature which remembers every word the user writes, and uses it in the code-completion. This is why the ctrl+space combo works in the first place. Does anyone know how to enable the suggestions?
What triggers the pop up is controlled by the auto_complete_selector setting. You will need to add the proper scope to that. If you are not using a syntax highlighter for those files, I believe this will apply the source scope to the file, which will then lead the pop up to show.
{
"name": "Modula-2",
"scopeName": "source.modula-2",
"fileTypes": [""],
"patterns": [
],
"uuid": "f8005a03-62cf-460b-84be-1184508464ed"
}
This is the JSON form, you can use PlistJsonConverter to convert to a plist. Then save that as a .tmLanguage file in the packages folder, probably the User Directory, or maybe a Modula-2 directory if you have other stuff associated with those types of files.
You should try Modula-2 Language Sintax it is a new package. You can install it using Package Control or simply by git clone git://github.com/harogaston/Sublime-Modula-2.git