You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "Achal1607 (via GitHub)" <gi...@apache.org> on 2023/10/28 05:13:52 UTC
[PR] [NETBEANS-6527] Do not cast FormatterDocument class to BaseDocument class for formatting xml files [netbeans]
Achal1607 opened a new pull request, #6631:
URL: https://github.com/apache/netbeans/pull/6631
When xml files are formatted using java lsp server, it throws an error since it tries to cast `FormatterDocument` class to `BaseDocument` class. So proposal is to cast `FormatterDocument` to `LineDocument` and `StyledDocument` instead of `BaseDocument` so that error is not thrown and xml files can be formatted.
closes #6527
---
**^Add meaningful description above**
By opening a pull request you confirm that, unless explicitly stated otherwise, the changes -
- are all your own work, and you have the right to contribute them.
- are contributed solely under the terms and conditions of the Apache License 2.0 (see section 5 of the license for more information).
Please make sure (eg. `git log`) that all commits have a valid name and email address for you in the Author field.
If you're a first time contributor, see the Contributing guidelines for more information.
If you're a committer, please label the PR before pressing "Create pull request" so that the right test jobs can run.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] [NETBEANS-6527] Do not cast FormatterDocument class to BaseDocument class for formatting xml files [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on PR #6631:
URL: https://github.com/apache/netbeans/pull/6631#issuecomment-1793516171
CV tests are failing
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] [NETBEANS-6527] Do not cast FormatterDocument class to BaseDocument class for formatting xml files [netbeans]
Posted by "lahodaj (via GitHub)" <gi...@apache.org>.
lahodaj commented on PR #6631:
URL: https://github.com/apache/netbeans/pull/6631#issuecomment-1811931286
I'll merge later tonight, unless there are objections.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] [NETBEANS-6527] Do not cast FormatterDocument class to BaseDocument class for formatting xml files [netbeans]
Posted by "lahodaj (via GitHub)" <gi...@apache.org>.
lahodaj merged PR #6631:
URL: https://github.com/apache/netbeans/pull/6631
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] [NETBEANS-6527] Do not cast FormatterDocument class to BaseDocument class for formatting xml files [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on PR #6631:
URL: https://github.com/apache/netbeans/pull/6631#issuecomment-1792824721
@Achal1607 please squash all commits into one and force push into your branch once the PR is ready - since we don't use the gh squash function.
I did also add a few labels so that the LSP and VSCode extension tests run when this PR syncs the next time.
Since PRs are directly linked from the release notes I am going to edit and remove the instructions from the PR template text to clean it up a bit. Feel free to simply remove the text yourself in future PRs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] [NETBEANS-6527] Do not cast FormatterDocument class to BaseDocument class for formatting xml files [netbeans]
Posted by "singh-akhilesh (via GitHub)" <gi...@apache.org>.
singh-akhilesh commented on code in PR #6631:
URL: https://github.com/apache/netbeans/pull/6631#discussion_r1375683115
##########
ide/xml.text/src/org/netbeans/modules/xml/text/indent/XMLLexerFormatter.java:
##########
@@ -70,11 +72,11 @@ protected LanguagePath supportedLanguagePath() {
// # 170343
public void reformat(Context context, final int startOffset, final int endOffset)
throws BadLocationException {
- final BaseDocument doc = (BaseDocument) context.document();
- doc.runAtomic(new Runnable() {
+ final Document doc = context.document();
+ NbDocument.runAtomic((StyledDocument)doc,new Runnable() {
Review Comment:
nitpick: ```new Runnable(){``` expression can be replaced with lambda
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] [NETBEANS-6527] Do not cast FormatterDocument class to BaseDocument class for formatting xml files [netbeans]
Posted by "singh-akhilesh (via GitHub)" <gi...@apache.org>.
singh-akhilesh commented on code in PR #6631:
URL: https://github.com/apache/netbeans/pull/6631#discussion_r1375683479
##########
ide/xml.text/src/org/netbeans/modules/xml/text/indent/XMLLexerFormatter.java:
##########
@@ -347,8 +349,8 @@ private void attributeName() throws BadLocationException {
firstAttributeIndent += spacesPerTab;
} else {
// align one space after the tagname:
- TokenIndent tagIndent = stack.peek();
- int current = Utilities.getVisualColumn((BaseDocument)basedoc, tokenSequence.offset());
+ TokenIndent tagIndent = stack.peek();
Review Comment:
nitpick: remove trailing with space
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists