Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Could quickfix be position sensitive?(Quickfix for more than one error/warning within a line)
Could quickfix be position sensitive? [message #1703373] Fri, 31 July 2015 07:44 Go to next message
Jiang Li is currently offline Jiang LiFriend
Messages: 27
Registered: November 2014
Junior Member
Hi,
I have noticed that the quickfix works not position sensitive.

I have following text line which has a warning and an error. If I move the cursor on the error or use "Ctrl+1", it shows the quickfix which is only for the warning.

index.php/fa/22731/0/

In position of error should the quickfix of warning not be shown. How can I resolve this problem?


  • Attachment: demo.png
    (Size: 7.79KB, Downloaded 255 times)
Re: Could quickfix be position sensitive? [message #1703374 is a reply to message #1703373] Fri, 31 July 2015 07:52 Go to previous messageGo to next message
Stefan Oehme is currently offline Stefan OehmeFriend
Messages: 159
Registered: April 2010
Location: Kiel
Senior Member

Hi Jiang,

this looks like you registered the "to lower case" quick fix for the "unknown field" validation. Could you show the relevant part of your QuickfixProvider?

Cheers,
Stefan
Re: Could quickfix be position sensitive? [message #1703390 is a reply to message #1703374] Fri, 31 July 2015 09:03 Go to previous messageGo to next message
Jiang Li is currently offline Jiang LiFriend
Messages: 27
Registered: November 2014
Junior Member
Stefan Oehme wrote on Fri, 31 July 2015 07:52
Hi Jiang,

this looks like you registered the "to lower case" quick fix for the "unknown field" validation. Could you show the relevant part of your QuickfixProvider?

Cheers,
Stefan


No. I'm sure that I have registered it correctly. If I move the cursor on the warning, the same quickfix can be also shown. It means that the quickfix could be shown on every error/warning in the same line.

I use xtext version 2.9. I don't know whether it has the same behaviors in previous version.

[Updated on: Fri, 31 July 2015 09:07]

Report message to a moderator

Re: Could quickfix be position sensitive? [message #1703392 is a reply to message #1703390] Fri, 31 July 2015 09:18 Go to previous messageGo to next message
Jiang Li is currently offline Jiang LiFriend
Messages: 27
Registered: November 2014
Junior Member
@Stefan

My code of quickfix for the warning:
	
@Fix(FopValidator.WRONG_CASE_CMDHEAD)
	def fixWrongCaseCmdHead(Issue issue, IssueResolutionAcceptor acceptor){
		acceptor.accept(issue, "Convert to lower case", "Convert the command name to the lower case", null) [ element, context |
			var offset = issue.offset;
			var length = issue.length;
			var doc = context.xtextDocument
			var id = doc.get(issue.offset, issue.length)
			doc.replace(offset, length, id.toLowerCase);
		]
	}

Re: Could quickfix be position sensitive? [message #1703423 is a reply to message #1703373] Fri, 31 July 2015 13:08 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3098
Registered: July 2009
Senior Member
Hi,

if there's only one quickfix for the issues on the current line, that
one will be proposed on Ctrl+1. Do you see a fix for sortfilename if it
is the only issue on that line?

Best,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Find help at http://xtext.itemis.com or xtext(@)itemis.com
Blog: zarnekow.blogspot.com
Twitter: @szarnekow
Google+: https://www.google.com/+SebastianZarnekow
Re: Could quickfix be position sensitive? [message #1703442 is a reply to message #1703423] Fri, 31 July 2015 15:09 Go to previous messageGo to next message
Jiang Li is currently offline Jiang LiFriend
Messages: 27
Registered: November 2014
Junior Member
Sebastian Zarnekow wrote on Fri, 31 July 2015 13:08
Hi,

if there's only one quickfix for the issues on the current line, that
one will be proposed on Ctrl+1. Do you see a fix for sortfilename if it
is the only issue on that line?

Best,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Find help at http://xtext.itemis.com or xtext(@)itemis.com
Blog: zarnekow.blogspot.com
Twitter: @szarnekow
Google+: https://www.google.com/+SebastianZarnekow


I have only one fix "to lower case" for the warning in the current line. There is no fix for "sortfilename ". Therefore I won't show the fix of "to lower case" when I move mouse on the "sortfilename ".

Can I restrict to show the proper fix according to the position of cursor?
Re: Could quickfix be position sensitive? [message #1703446 is a reply to message #1703442] Fri, 31 July 2015 15:30 Go to previous messageGo to next message
Jiang Li is currently offline Jiang LiFriend
Messages: 27
Registered: November 2014
Junior Member
@Sebastian
I made a following test after reading your reply:
Adding a fix also for the "sortfilename". It works fine. Both error and warning get their own fix in the proposal.

When there is only one fix in a line, can I restrict the showing of fix according to the position? Is it possible?
Re: Could quickfix be position sensitive? [message #1776039 is a reply to message #1703446] Thu, 09 November 2017 15:50 Go to previous message
Chris X is currently offline Chris XFriend
Messages: 60
Registered: November 2017
Member
@Jiang LiFriend

Could you solve the problem? Because I have the same issue.
Previous Topic:How to correctly modify the order of containment references in an XTextEditor?
Next Topic:Content Assist for external information
Goto Forum:
  


Current Time: Sat Oct 20 02:40:02 GMT 2018

Powered by FUDForum. Page generated in 0.02896 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top