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

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

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.

Chrome on startup to continue where I left off and one more page

Whenever I open chrome, I want:
All my previous pages are there
Another page, with a custom URL, is there. (With the possibility of me setting it to be chrome://newtab.)
Is this possible?
Is there a way that on open specific set of pages, I can add previous pages?
I have tried looking. The closest thing I could find was this. This is not exactly what I wanted.
I would like a simple and easy way of doing this. (I don't mind extensions but I couldn't find any.)
I want this to be done without any input from me every time. So no CtrlShiftT please.
Thank you in advance.
If you need to automate Chrome GUI, it's possible using pywinauto. My student wrote an example dragging file from explorer.exe to Google Disk opened in Chrome. There are some tricks used here.
test_explorer_google_drive.py
Chrome requires command line parameter --force-renderer-accessibility to enable MS UI Automation support in Chrome. So if you're starting Chrome it should work for you. If you're trying to connect to existing Chrome window this might be a problem.
Need to use backend='uia' explicitly for pywinauto.Application object. See the Getting Started Guide for more details, core concept and other useful things.
The relevant part of the mentioned script:
from pywinauto import Application
chrome_dir = r'"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"'
# start Chrome
chrome = Application(backend='uia')
chrome.start(chrome_dir + ' --force-renderer-accessibility --incognito --start-maximized <URL>')
# wait while page is loading (up to 10 sec.)
chrome['<Tab caption>'].child_window(title_re='Reload.*', control_type='Button').wait('visible', timeout=10)
the details of this may depend on your operating system but on windows I can access a "master_preferences" file in C: > Program Files > Google > Chrome > application.
the contents of the file looks like:
{
"homepage": "http://www.google.com/",
"homepage_is_newtabpage": false,
"distribution": {
"suppress_first_run_bubble": false,
"import_search_engine": false,
"import_history": false,
"do_not_launch_chrome": true,
"make_chrome_default": false,
"verbose_logging": false,
"ping_delay": -60
},
"sync_promo": {
"show_on_first_run_allowed": false
},
"session": {
"restore_on_startup": 4,
"startup_urls": ["http://www.google.com/"]
},
"first_run_tabs": ["http://www.google.com/", "http://welcome_page"]
}
You can see there are settings for restore_on_startup
and startup_urls under the "session" heading
try editing those settings so the look like this:
"restore_on_startup": 2,
"startup_urls": ["http://www.google.com/", "http://www.theurlyouwant.com"]
You may not be able to configure these settings on your work or school computer as it requires administrator privileges. And also if you're not familiar with JSON pay especial close attention to the syntax (commas, quotation marks etc) I've used in my examples.
I don't know if this will help, it's certainly not as technical a response as everyone else, but I use the OneTab Chrome extension to do some of the stuff you're talking about.
I have a handful of pages saved to it, and I click the Restore All button and they all load in. You can save groups of tabs, and lock those groups so they're not easily deleted on accident, and name groups of saved tabs as well. I think it's pretty helpful, but it might not be exactly what you need/are looking for. Hope it helps though!

How to fix the error "Rename refactoring can't be applied in this context" in Netbeans?

I'm currently working on a HTML5 projects in netbeans and wanted to change a variable name with multiple occurrence. However, when I clicked refactor and then rename, the IDE tells me that:
Rename refactoring can't be applied in this context.
So is it possible to refactor variable names in HTML5 projects in Netbeans?
The JavaScript refactoring options are very limited, typically it works only in context of single file and you can invoke it by placing cursor on the target variable/function and pressing Ctrl+R (sorry, not sure about the shortcut on Mac) and then typing a new name. This is not full refactoring, only "limited rename" and again, it will rename variables only in given file, not the whole project.
Please note that in NetBeans if you open Refactor from the main menu, there is also Rename action with the same shortcut displayed but the shortcut is actually doing something else than the menu item.

How to stop opening files in browser upon save

I'm using Sublime Text 2 (which I love). I have it set to auto-save upon lost focus, to it automatically saves. Somehow, however, I've done something such that when it saves, it opens in a browser. This must be some build function that's getting triggered, but I don't know where to look for it. I looked for a BuildOnSave package in the installed packages, but I didn't see anything remotely related to 'Save' or 'Build', etc.
Does anyone have any ideas of where to look? I don't really want to have to revert to pristine state and then have to re-install my plugins as this us pretty darn annoying.
My currently installed packages are below, if it helps.
"installed_packages":
[
"AMD Module Editor",
"CoffeeScript",
"Dayle Rees Color Schemes",
"Emmet",
"Emmet Css Snippets",
"Git",
"Gitignore",
"JSLint",
"LESS",
"Markdown Preview",
"Package Control",
"SublimeLinter"
],
Thanks,
Scott
Try disabling Markdown Preview, as it looks like it could be the culprit. It has some built-in build systems, and you likely somehow activated a "build on save" feature. None of the other packages (that I'm aware of) have similar functionality that would give the symptoms you're seeing.
To deactivate, select Preferences -> Browse Packages... to open a file browser window of the Sublime Text 2 Packages directory. Move (don't copy) the Packages/Markdown Preview directory to someplace else, like your Desktop, for now. Quit and restart ST2, and see if the issue persists. If not, this plugin was at fault, and you can start poking around in its settings (after moving it back to the Packages folder) to see where the error is. One place to look is in Tools -> Build System and deselect Markdown.
Good luck!

How can I disable "HTML Checking" in NetBeans?

I'm using NetBean's Compile on Save setting, and it's really handy when I'm editing a single file. But when I'm dealing with a pair of (or more) class files and am switching between the files, I have a problem:
The Task tab is nearly worthless since it is littered by HTML "error" messages(+) from many dozens of HTML files in the project that are generated by some external tool. The number of HTML errors swamps out any actual Java errors.
What I want is one of:
A way to tell NB to ignore the directory with the HTML files ("help").
A way to turn off HTML "errors" or even to specify HTML2.
A way to filter "Task" errors by file type, parent folder: all Java is under "com".
I've perused the settings and properties, but found nothing that helps.
<rant> Yet another reason I hate an IDE that use the "Take Everything in the Folder" approach.... </rant>
+ = The files are valid HTML but probably not XHTML. Plus, half the messages end abruptly, with something like: "Unexpected tag <TD> found, expecting one of
I found the answer, or at least one that works for me (NB 6.8, YMMV):
In the Tasks tab, click the filter button in the left,
Choose Edit...
In the Task List Filter dialog:
Click New
Enter a value for Name (such as "No Script Messages"),
Uncheck the Scripting Language Tasks option
Click OK.
If the filter doesn't work immediately, you may wish to close/open the Task window or Netbeans.
Hope that helps someone else.
You can go to Tools->options->Editor->Hint .
You can easily select the right options from there .
I want to use task list to only track my To Do list and It can be a real pain when Netbeans starts showing me #todos from included libraries and all sort of compile errors that I am not interested in. If your use case is like me (not interested in compile errors etc. in task window) then you can do following:- (Netbeans 7.1.2)
1) Tasks window | Right click filter | Edit
To edit the default filter.
Click default filter in left hand panel.
Right hand panel, under Type tab - un-check compile errors and issues
2) You can go to Tools | Options | Miscellaneous
Go to Tasks tab now.
Here you can add/remove the To Do strings that you want.
You can create your own custom todo string or make sure that only one of them is listed (what you use)
Now apply default filter and you will only see your #todo tasks. sane and sweet :D