Tested in python using pylsp as the LSP server, if I reference a function in the current file and do "Goto Definition" it doesn't jump there if the file is read only (I.e. if I just did "goto definition" and it jumped to a file in my site-packages, it'll be read only).