blob: 4e9ec83a230b21d124f84765e7a91b2fd969f939 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2016 Kichwa Coders and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* Contributors:
* Jonah Graham (Kichwa Coders) - initial API and implementation
*******************************************************************************/
package org.eclipse.ease.lang.python;
import org.eclipse.ease.IScriptEngine;
import org.eclipse.ease.ui.completion.CompletionContext;
public class PythonCompletionContext extends CompletionContext {
public PythonCompletionContext(IScriptEngine scriptEngine) {
super(scriptEngine, PythonHelper.getScriptType());
}
@Override
protected String simplifyCode() {
final String code = super.simplifyCode();
// XXX: API needs a review here, these simplifications are Py4J specific, not
// all Python code.
if (code.startsWith("jvm.gateway."))
return code.substring("jvm.gateway.".length());
if (code.startsWith("gateway."))
return code.substring("gateway.".length());
return code;
}
@Override
protected boolean isLiteral(final char candidate) {
return "'\"".indexOf(candidate) != -1;
}
}