eclipse.jdt.ls
eclipse.jdt.ls copied to clipboard
How to disable autoimport
@fbricon @snjeza
Editor: Monaco editor
language client: Monaco language client
In our use case we want to disable autoimport. How to stop sending completionItem/resolve
@GNSubrahmanyam you can try the following settings:
"java.completion.enabled": false,
@snjeza In that case no auto complete is coming. We need autocomplete. We want to disable auto import statements
It's not possible to disable automatic type import at that point. Can you explain how auto import is a problem in monaco?
In our use case we locked few lines in code editor. Where candidates or learners will write code in editable part. While typing candidates or learners selects method from the codeCompleteItem (Example: StreamDecoder from com.oracle.webservices.internal.impl.internalspi.encoding.* it automatically imports com.oracle.webservices.internal.impl.internalspi.encoding.)
It mess up the whole codelock feature.
@fbricon Is there any way to suggest method autocomplete for imported packages only?
@fbricon Any updates how we can achieve this?
@fbricon Found a solution
import { has, get, map, omit, set} from "lodash";
import * as rpc from "vscode-ws-jsonrpc";
export const launch = (request: http.IncomingMessage, socket: rpc.IWebSocket) => {
if (rpc.isResponseMessage(message)) {
if (typeof message.result === 'object' && has(message.result, 'isIncomplete')) {
let items = map(get(message.result, 'items'), (item) => {
if (has(item, 'additionalTextEdits')) {
item = omit(item, 'additionalTextEdits')
return item;
}
return item;
})
set(message.result, 'items', items)
}
}
interesting, where do you put that code?
https://github.com/TypeFox/monaco-languageclient/blob/master/example/src/json-server-launcher.ts#L20 inside forward
Am i doing right ? By omitting additionalTextEdits
that's very, very hacky. I'm not sure but other things than import statements might be sent as additional textedits.
True, In our case we don't want auto import. What are other alternative to achieve this ?
@GNSubrahmanyam Hi can you please help me with the configs used to make it work with monaco-languageclient? To ve more specific - How to modify this line --https://github.com/TypeFox/monaco-languageclient/blob/69f41d2c2d9b37bcbb9a080d86ec2eed838d6885/example/src/json-server-launcher.ts#L19
to make it work with -- this java lsp.
And do we need any other chnages?