mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Disable IPython completion for speed (PY-30222) and correct types showing (PY-30611)
IPython completion works very slow in some cases and becomes useless. It's better to make completion less detailed, but
This commit is contained in:
@@ -170,12 +170,9 @@ def generate_completions_as_xml(frame, act_tok):
|
||||
updated_globals.update(frame.f_globals)
|
||||
updated_globals.update(frame.f_locals) #locals later because it has precedence over the actual globals
|
||||
|
||||
if pydevconsole.IPYTHON:
|
||||
completions = pydevconsole.get_completions(act_tok, act_tok, updated_globals, frame.f_locals)
|
||||
else:
|
||||
completer = Completer(updated_globals, None)
|
||||
#list(tuple(name, descr, parameters, type))
|
||||
completions = completer.complete(act_tok)
|
||||
completer = Completer(updated_globals, None)
|
||||
#list(tuple(name, descr, parameters, type))
|
||||
completions = completer.complete(act_tok)
|
||||
|
||||
valid_xml = pydevd_xml.make_valid_xml_value
|
||||
quote = pydevd_xml.quote
|
||||
|
||||
@@ -510,6 +510,18 @@ class BaseInterpreterInterface:
|
||||
xml.write("</xml>")
|
||||
return xml.getvalue()
|
||||
|
||||
def getCompletions(self, text, act_tok):
|
||||
try:
|
||||
from _pydev_bundle._pydev_completer import Completer
|
||||
|
||||
completer = Completer(self.get_namespace(), None)
|
||||
return completer.complete(act_tok)
|
||||
except:
|
||||
import traceback
|
||||
|
||||
traceback.print_exc()
|
||||
return []
|
||||
|
||||
def loadFullValue(self, seq, scope_attrs):
|
||||
"""
|
||||
Evaluate full value for async Console variables in a separate thread and send results to IDE side
|
||||
|
||||
@@ -47,9 +47,6 @@ class InterpreterInterface(BaseInterpreterInterface):
|
||||
def get_namespace(self):
|
||||
return self.interpreter.get_namespace()
|
||||
|
||||
def getCompletions(self, text, act_tok):
|
||||
return self.interpreter.getCompletions(text, act_tok)
|
||||
|
||||
def close(self):
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
@@ -97,29 +97,14 @@ class InterpreterInterface(BaseInterpreterInterface):
|
||||
self.interpreter = InteractiveConsole(self.namespace)
|
||||
self._input_error_printed = False
|
||||
|
||||
|
||||
def do_add_exec(self, codeFragment):
|
||||
command = Command(self.interpreter, codeFragment)
|
||||
command.run()
|
||||
return command.more
|
||||
|
||||
|
||||
def get_namespace(self):
|
||||
return self.namespace
|
||||
|
||||
|
||||
def getCompletions(self, text, act_tok):
|
||||
try:
|
||||
from _pydev_bundle._pydev_completer import Completer
|
||||
|
||||
completer = Completer(self.namespace, None)
|
||||
return completer.complete(act_tok)
|
||||
except:
|
||||
import traceback
|
||||
|
||||
traceback.print_exc()
|
||||
return []
|
||||
|
||||
def close(self):
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ public class PydevConsoleReference extends PsiPolyVariantReferenceBase<PyReferen
|
||||
|
||||
String args = completion.getArgs();
|
||||
if (args.equals("(%)")) {
|
||||
builder.withPresentableText("%" + completion.getName());
|
||||
builder = builder.withPresentableText("%" + completion.getName());
|
||||
builder = builder.withInsertHandler(new InsertHandler<LookupElement>() {
|
||||
@Override
|
||||
public void handleInsert(InsertionContext context, LookupElement item) {
|
||||
|
||||
@@ -1016,7 +1016,6 @@ public class PyDebugProcess extends XDebugProcess implements IPyDebugProcess, Pr
|
||||
@NotNull
|
||||
public List<PydevCompletionVariant> getCompletions(String prefix) throws Exception {
|
||||
if (isConnected()) {
|
||||
dropFrameCaches();
|
||||
final PyStackFrame frame = currentFrame();
|
||||
return myDebugger.getCompletions(frame.getThreadId(), frame.getFrameId(), prefix);
|
||||
}
|
||||
@@ -1026,7 +1025,6 @@ public class PyDebugProcess extends XDebugProcess implements IPyDebugProcess, Pr
|
||||
@NotNull
|
||||
public String getDescription(String prefix) throws Exception {
|
||||
if (isConnected()) {
|
||||
dropFrameCaches();
|
||||
final PyStackFrame frame = currentFrame();
|
||||
return myDebugger.getDescription(frame.getThreadId(), frame.getFrameId(), prefix);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user