-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Symbol uses #34
Symbol uses #34
Conversation
I want to click the |
yield { StartLine = su.RangeAlternate.StartLine | ||
StartColumn = su.RangeAlternate.StartColumn + 1 | ||
EndLine = su.RangeAlternate.EndLine | ||
EndColumn = su.RangeAlternate.EndColumn + 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding 1 here doesn't seem right, they should already be 1-based from the Alternate
syntax. Looking at the results I also think they should end one earlier e.g. with:
let testval = FileTwo.NewObjectType()
The results have a range with columns start=5 and end=12. t
is definitely at 5, and l
is 6 further on, so 11. This is an inclusive range and I think we should leave it alone, documenting it as such (if we ever get around to adding documentation for this project!). If editors prefer to work with an exclusive range they can make the adjustement locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
XS columns are 1 based we do something like:
let start, finish = Symbols.trimSymbolRegion symbolUse lastIdentAtLoc
let filename = doc.FileName.ToString()
let offset = doc.LocationToOffset(start.Line, start.Column+1)
let domRegion = DomRegion(filename, start.Line, start.Column+1, finish.Line, finish.Column+1)
let symbol = createSymbol(doc, context, symbolUse.Symbol, lastIdentAtLoc, domRegion)
let memberRef = MemberReference(symbol, filename, offset, lastIdentAtLoc.Length)
//if the current range is a symbol range and the fileNameOfRefs match change the ReferenceUsageType
if symbolUse.IsFromDefinition then
memberRef.ReferenceUsageType <- ReferenceUsageType.Write
memberRef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how to fix this. FCS seems to report 0-based columns (lines are 1-based). Do you want me to only add 1 to StartColumn
? That doesn't seem right to me. That would leave testva
highlighted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I misread. It seems that FCS accepts 1-based column numbers but returns 0-based. Why would this possibly be a good idea?
I've looked at the output we give and I think only declarations
, finddecl
and this new command return positions. I think they should all return 0-based or all return 1-based columns, for consistency. However, I think that if FCS is outputting 0-based columns it should probably be accepting 0-based as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is all very confusing. Adding 1 to StartColumn
and EndColumn
seems to be the right thing to do, so we normalize to consistently being 1-based . Do the other commands return 0-based?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Find Declaration seems to return 0-based.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I guess you posted at the same time as me ;-)
I would be happy if everything returned 1-based so at least FSAC is consistent even if FCS isn't.
@7sharp9 do you adjust the results you get from GetNavigationItems
for the pathed document support as well to be 1-based?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do it. :)
Separate PR or this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is fine by me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Otherwise looks great. Thanks so much for the contribution, things are really coming on! |
@@ -461,7 +485,7 @@ module internal Main = | |||
let sb = new System.Text.StringBuilder() | |||
sb.AppendLine("DATA: errors") |> ignore | |||
for e in errs do | |||
sb.AppendLine(sprintf "[%d:%d-%d:%d] %s %s" e.StartLineAlternate e.StartColumn e.EndLineAlternate e.EndColumn | |||
sb.AppendLine(sprintf "[%d:%d-%d:%d] %s %s" e.StartLineAlternate (e.StartColumn + 1) e.EndLineAlternate (e.EndColumn + 1) | |||
(if e.Severity = FSharpErrorSeverity.Error then "ERROR" else "WARNING") e.Message) | |||
|> ignore | |||
sb.Append("<<EOF>>") |> ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JSON printing just below Data =errs
is also affected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I'll fix it shortly.
Having to also correct the errors makes it less enjoyable :-( |
Argh, |
In doing a record type, should I keep |
In doing so, I also removed FSharpErrorInfo.StartLineAlternate and FSharpErrorInfo.EndLineAlternate. Now there is only StartLine/EndLine, and they're 1-based.
With that, I think I'm done. :) |
Implements #31.
I botched the previous PR by rebasing, so git wouldn't let me push (when will I ever learn).
I added a few fields from
SymbolUse
, includingIsFromDefinition
which should address @7sharp9's concern. Anything else that should be included?