Community
Participate
Working Groups
In order to implement a solution for bug 419399 jface.text framework has to give more freedom to plugins implementing code formatters when dealing with an empty selection. Currently SourceViewer class contains the following code that interprets an empty selection as formatting of the whole document. if (selection.y == 0) { context.setProperty(FormattingContextProperties.CONTEXT_DOCUMENT, Boolean.TRUE); } else { context.setProperty(FormattingContextProperties.CONTEXT_DOCUMENT, Boolean.FALSE); context.setProperty(FormattingContextProperties.CONTEXT_REGION, new Region(selection.x, selection.y)); } A proposed solution is to a allow the creator of the formatting context to indicate that an empty selection should be passed to the formatter instead of being replaced by the entire document.
A proposed solution is in https://git.eclipse.org/r/#/c/31337/. The corresponding CDT change that addresses bug 419399 is in https://git.eclipse.org/r/#/c/31338/.
Dani, could you please review the patch https://git.eclipse.org/r/#/c/31337/ in Gerrit. Thanks you.
(In reply to Sergey Prigogin from comment #2) > Dani, could you please review the patch > https://git.eclipse.org/r/#/c/31337/ in Gerrit. Thanks you. Hi Sergey. Sorry, this got missed and I'm traveling this week. I'll look at this during M3 for sure.
M3 is quickly approaching...
(In reply to Dani Megert from comment #3) > Hi Sergey. Sorry, this got missed and I'm traveling this week. I'll look at > this during M3 for sure. Hi Dani. In order to keep your promise you should probably review the patch now. Otherwise it is going to hit the code freeze week before M3.
(In reply to Sergey Prigogin from comment #5) > (In reply to Dani Megert from comment #3) > > Hi Sergey. Sorry, this got missed and I'm traveling this week. I'll look at > > this during M3 for sure. > > Hi Dani. In order to keep your promise you should probably review the patch > now. Otherwise it is going to hit the code freeze week before M3. It's definitely on my list for this week!
Hi Sergey, if added my comments in Gerrit.
Submitted with http://git.eclipse.org/c/platform/eclipse.platform.text.git/commit/?id=396f7fa1c29c2318a8fc956bf7bdc836f9920f0c
(In reply to Dani Megert from comment #8) > Submitted with > http://git.eclipse.org/c/platform/eclipse.platform.text.git/commit/ > ?id=396f7fa1c29c2318a8fc956bf7bdc836f9920f0c For some mysterious reason this commit doesn't show up in http://git.eclipse.org/c/platform/eclipse.platform.text.git/log/
(In reply to Sergey Prigogin from comment #9) > (In reply to Dani Megert from comment #8) > > Submitted with > > http://git.eclipse.org/c/platform/eclipse.platform.text.git/commit/ > > ?id=396f7fa1c29c2318a8fc956bf7bdc836f9920f0c > > For some mysterious reason this commit doesn't show up in > http://git.eclipse.org/c/platform/eclipse.platform.text.git/log/ Thanks for catching this. No idea what Gerrit did. Maybe it didn't merge because I just rebased before. Anyway, it's there now: http://git.eclipse.org/c/platform/eclipse.platform.text.git/commit/?id=1be15476ed99918ea8a9674d8ceb7884a430fc69