redhat-developer / redhat-developer/vscode-java
java formatter: unable to wrap/break long Strings
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 2.3k
- Fork
- 546
- Merge medio
- 20h 1m
- PR unite (30g)
- 11
Descrizione
I come from Intellij idea and I'm used to break long lines with the formatter. I managed to export/import most of the settings, but I can not manage it that vscode breaks long String lines, splitting the Strings with "firstPart" + "secondPart".
These are my related settings in the codeFormatterSettings.json:
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="180"/>
<setting id="org.eclipse.jdt.core.formatter.formatter_wrap_long_strings" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_strings" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_string_concatenation" value="true"/>
Please ask if I should upload the whole file.
This is an example line of code:
String strSystemPrompt =
"You are a system that generates a concise and informative answer in less than 100 words for the given question, which is marked with QUESTION. Use the given search results marked with SEARCH RESULT as only knowledge base. Answer questions in the language of the question, i.e. german questions in german and only english questions in english.";
This is the expected output:
String strSystemPrompt =
"You are a system that generates a concise and informative answer in less than 100 words for the given question, which is marked with QUESTION. Use the given search" +
"results marked with SEARCH RESULT as only knowledge base. Answer questions in the language of the question, i.e. german questions in german and only english" +
"questions in english.";
Am I missing something, is it not supported, or is it a bug?
VSCode version 1.98.2
Java Language support:
Version
1.40.0
Last Updated
2025-03-06, 08:33:26
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia riproducendo il comportamento del formatter con le impostazioni mostrate in codeFormatterSettings.json e l’esempio Java dell’issue. Verifica se le opzioni elencate per le stringhe lunghe e la concatenazione di stringhe arrivano al formatter Java utilizzato dalla VS Code extension. Il lavoro è completato quando i letterali di stringa Java lunghi vengono suddivisi in stringhe concatenate come mostrato nell’output previsto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- tooling
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100