I am getting my feet wet with python, and I have to admit - it is fun!
I have a few questions:
1) I am not writing in a case sensitive lang, so I wanted autoComplete to offer options even if they didnt match the case. I tried setting editor.autoCSetIgnoreCase(1), but it still didnt offer matches. I also put it into startup.py - also didnt work. I checked it by testing console.write(str(autoCGetIgnoreCase())) and it was writing true! What am I missing?
2) In the API for npp, there are some functions which say they have 2 return values... I dont understand that.
E.g. getLine(line) - Retrieve the contents of a line. Returns the length of the line.
This function returns the contents, so what does it mean that it returns the length?
And there are more like this.
3) Python in general, is there a special editor to write python code?
E.g. Is there something like visual studio that offers autoComplete and debugging etc.?
Thanks in advance,
I don't know the answer to 1, sorry. I presume you're using a notepad++ api
file to do the autocomplete - you're then probably at the mercy of n++, and
what it thinks are matches, rather than what scintilla thinks are
matches, hence the autoCSetIgnoreCase has no effect. You could do the auto
complete yourself - see the scintilla documentation on autocomplete (and
user lists, which are more flexible, but a bit more effort).
The documentation for the scintilla functions is taken directly from
scintilla. Unfortunately this is basically a C api, and hence it needs
things like string lengths to be passed in and returned. Python Script
wraps all that up for you (including in some cases the string encoding), so
you just call getLine() and you get the python string back. Under the
covers, it actually calls getLine twice, once to see how big a buffer is
needed, then again to get the contents of the line. It's then converted to
a python string, and given back to you. What all this means is that the
documentation is in some (many) cases, not correct for the parameters.
There is a disclaimer in the docs to this effect.
I've not used it, but I believe PyCharm is very good (and it's from
JetBrains, and *everything * from them is good)
Hope that helps.
1) Not sure
2) See this. I ran editor.getLine(0) in the console and it looks like it is just returning the string. However I will state this was using v0.9.2 which may be different since there are newer versions out.
3) I usually use IDLE which comes bundled with the Windows installer for Python. When installing you have to make sure to install the Tkinter package (I think that's the name) and that will also install IDLE. It is nothing fancy but it does everything I've needed so far. There are also other editors but I can't speak for those since I haven't ever really used them but some look very powerful when working with large projects.
Thanks for your responses
Yes, I am using Notepad++ autoC - I didnt know that it didnt use scintilla for this - Thanks for pointing that out to me
I understand - I guess I didnt see that disclaimer
Great - thanks. I think I'll stick with IDLE for now