-
Notifications
You must be signed in to change notification settings - Fork 28
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
Options to only show functional changes in diffs #349
Comments
err actually I guess the package main
import "fmt"
func main() {
a := "string"
fmt.Println(a)
} package main
import "fmt"
// comments in the file
func main() {
b := "string"
fmt.Println(b)
c := "hi"
fmt.Println(c)
} caused:
|
Thanks for the bug report! And I'll think about more intelligent modes for diffsitter - we could possibly do something like only checking for diffs between tokens of a certain type. It's not super straightforward to me right now because sometimes changing an identifier can actually change the program. As an example: package main
import "fmt"
// comments in the file
func main() {
b := "string"
fmt.Println(b)
c := "hi"
fmt.Println(c)
} to package main
import "fmt"
// comments in the file
func main() {
c := "string"
fmt.Println(b)
c := "hi"
fmt.Println(c)
} is a meaningful change, so simply filtering based on a token type wouldn't work here. |
I installed it from
|
Hmm it seems like the binary is showing 0.7.0 but the package is for 0.7.1? I don't think it should make a difference in any case. Could you do me a favor and run that with the backtrace environment variable turned on and with the --debug flag so I could see the full log |
Is your feature request related to a problem? Please describe.
I noticed that diffsitter returns
0
when the two files have the same AST, which is awesome. However, it still produces output if there are nonfunctional changes. Example programs:Produces:
In the event that you have something like a mass refactor which you expect not to have functional changes, if one ends up showing up you are not easily able to find it.
Describe the solution you'd like
I would like it if there were a setting which, when enabled, would make
diffsitter
print only the changes which meaningfully alter the AST.Describe alternatives you've considered
I thought about writing my own but it would only support Go. This project seems like a great base to bring this to many languages.
Additional context
I am not sure but I would suspect the various different semantics between languages may make this a somewhat complicated request (I don't know off the top of my head but I suspect, software being the way it is, that there may exist a language or framework where merely changing a variable name has functional impacts).
The text was updated successfully, but these errors were encountered: