snakecharm icon indicating copy to clipboard operation
snakecharm copied to clipboard

Implicit Includes support

Open iromeo opened this issue 5 years ago • 2 comments

Code insight support for case

# foo.smk
rule foo:
  output: "foo.out"
# boo.smk
rule boo:
  input: rules.foo.output
  output: "out"
# Snakefile
include "foo.smk"
include "boo.smk"
# other.smk
rule other:
   output: "other.out"

In this case all rules from foo.smk and rules defined before include "boo.smk" will be accessible inside boo.smk file although boo.smk doesn't include 'foo.smk`.

We likely need to cache information about which files includes the current file. E.g it could be done lazily by inspection in thread-safe way. E.g. like PyTypes cache.

So we need

  • [ ] Update rule redeclaration inspection to handle such implicit redeclaration (likely weak warning)
  • [ ] Implement inspection which checks whether rule is implicitly included into current context or not. E.g. it is ok to use foo rule in boo.smk but we cannot use other rule in boo.smk
  • [ ] Optionally update default autocompletion mentioned in #173

iromeo avatar Aug 16 '19 09:08 iromeo

Related to #155, #173

iromeo avatar Aug 16 '19 09:08 iromeo

Related commits:

https://github.com/JetBrains-Research/snakecharm/pull/164/commits/3a650a3034a5596b5ca1d84d81dbb44d2b21d244

https://github.com/JetBrains-Research/snakecharm/pull/164/commits/828750cc3fb66bcb3341c8d79caf597abece17f3

iromeo avatar Aug 16 '19 09:08 iromeo