Skip to content

hsdev-0.3.0.0#386

Closed
mvoidex wants to merge 70 commits intomasterfrom
hsdev-3
Closed

hsdev-0.3.0.0#386
mvoidex wants to merge 70 commits intomasterfrom
hsdev-3

Conversation

@mvoidex
Copy link
Copy Markdown
Member

@mvoidex mvoidex commented Jan 4, 2018

@bscottm, created PR just to mention about huge updates in hsdev.

In this PR i've updated backend to use new API and to test hsdev-0.3.0.0

  1. now uses haskell-names to resolve names in sources, and thus go to definition works for local bindings
  2. now stores data in sqlite, so in my case user-db + package-db + project takes ~30Mb
  3. hsdev doesn't drop ghc session anymore, so consecutive checks of same module (or modules within same project) are much faster
  4. added new commands:
  • usages - get all uses of symbol (also, as long as all data is in sql, you can easily inspect it, for example i made query to find symbols, that are used least (2 - 1 for declaration and 1 for export list), and so removed many unused stuff :)
  • whoat - same as whois, but accepts location instead of name
  • rename - generates same output as autofixes (was autofix show), so can be applied with refactor command or by editor itself

@bscottm
Copy link
Copy Markdown
Contributor

bscottm commented Jan 6, 2018

@mvoidex: Probably want to resolve the conflicts before merging.

Q: Is hsdev-0.3.0.0 backwardly compatible? Or will everyone have to upgrade to 0.3.0.0 when they take this update? I'd suggest remaining backwardly compatible for a while, if possible.

# Conflicts:
#	event_common.py
#	hsdev/backend.py
#	hsdev/result_parse.py
@mvoidex
Copy link
Copy Markdown
Member Author

mvoidex commented Jan 9, 2018

@bscottm, hsdev-0.3.0.0 is not backward compatible as there are many internal and some API changes.
However, I think, it's possible to support both versions, but this will require some additional work.

Copy link
Copy Markdown
Contributor

@bscottm bscottm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a reason for blocking -- getting the success status of the check/lint process to determine whether other post-save actions should execute. Generally, the pause is short enough that blocking isn't really an issue. So far, no complaints.

The other reason is that the hsdev receiver (hsdev/client.py) blocks until the response function returns. That effectively prevents the response function from making more requests to hsdev (because the receiver is blocked...)

Also, avoid local functions within functions unless you truly need the closure from the outer function.

@mvoidex
Copy link
Copy Markdown
Member Author

mvoidex commented Jan 9, 2018

Why not use continuations?
Pause is definitely not short, at least in my case it takes several seconds first time and about 700-800 msecs on each consecutive check.

Also, avoid local functions within functions.
Ok

@bscottm
Copy link
Copy Markdown
Contributor

bscottm commented Jan 13, 2018

I don't disagree with continuations, on principle. In the case of check/lint, I'm trying to remember the exact reason -- I was probably trying to track down one of @Pastafarianist's "prettify_on_save doesn't work" bugs. There are a sequence of actions that depend on check/lint success before they execute, which means adding more continuations onto the check/lint code. Just easier and slightly more maintainable to make check/lint blocking.

@bscottm
Copy link
Copy Markdown
Contributor

bscottm commented Jan 14, 2018

2.1.18 will make check/lint async again.

@moodmosaic
Copy link
Copy Markdown
Contributor

Is there a way to somehow hide those errors from the console? (Even if I have to temporarily comment-out a few lines of code from my local SH source.)

<hsdev stderr> �[96m2018-03-23 13:54:39 +0200�[m�[m	�[m�[91mERROR�[m�[m	�[m�[95m�[m�[m:�[m�[92mupdate/cabal/task/package-db-stack�[m�[m> �[m�[mScope leaves with exception: tool 'C:\Users\Nikos\AppData\Local\Programs\stack\x86_64-windows\ghc-8.2.2\bin\ghc-pkg.exe' failed: empty output, expecting path to user package db
<hsdev stderr> CallStack (from HasCallStack):
<hsdev stderr>   onError, called at src\System\Log\Simple\Monad.hs:104:36 in simple-log-0.9.3-AwZTZEnHmtHLEWAKWQWBHK:System.Log.Simple.Monad
<hsdev stderr> �[m�[m
<hsdev stderr> �[96m2018-03-23 13:54:39 +0200�[m�[m	�[m�[91mERROR�[m�[m	�[m�[95m�[m�[m:�[m�[92mupdate/cabal/task�[m�[m> �[m�[mScope leaves with exception: tool 'C:\Users\Nikos\AppData\Local\Programs\stack\x86_64-windows\ghc-8.2.2\bin\ghc-pkg.exe' failed: empty output, expecting path to user package db
<hsdev stderr> CallStack (from HasCallStack):
<hsdev stderr>   onError, called at src\System\Log\Simple\Monad.hs:104:36 in simple-log-0.9.3-AwZTZEnHmtHLEWAKWQWBHK:System.Log.Simple.Monad
<hsdev stderr> �[m�[m
<hsdev stderr> �[96m2018-03-23 13:54:39 +0200�[m�[m	�[m�[91mERROR�[m�[m	�[m�[95m�[m�[m:�[m�[92mupdate/cabal�[m�[m> �[m�[mScope leaves with exception: tool 'C:\Users\Nikos\AppData\Local\Programs\stack\x86_64-windows\ghc-8.2.2\bin\ghc-pkg.exe' failed: empty output, expecting path to user package db
<hsdev stderr> CallStack (from HasCallStack):
<hsdev stderr>   onError, called at src\System\Log\Simple\Monad.hs:104:36 in simple-log-0.9.3-AwZTZEnHmtHLEWAKWQWBHK:System.Log.Simple.Monad
<hsdev stderr> �[m�[m
<hsdev stderr> �[96m2018-03-23 13:54:39 +0200�[m�[m	�[m�[91mERROR�[m�[m	�[m�[95m�[m�[m:�[m�[92mupdate�[m�[m> �[m�[mtool 'C:\Users\Nikos\AppData\Local\Programs\stack\x86_64-windows\ghc-8.2.2\bin\ghc-pkg.exe' failed: empty output, expecting path to user package db�[m�[m

@mvoidex
Copy link
Copy Markdown
Member Author

mvoidex commented Mar 23, 2018

@moodmosaic there's issue mvoidex/hsdev#81, i'll try to fix it this weekend

@moodmosaic
Copy link
Copy Markdown
Contributor

moodmosaic commented Mar 23, 2018

Sounds great ❤️ In general is there a way to disable all output from hsdev in SH so that it doesn't show up in the ST3 console?

@moodmosaic
Copy link
Copy Markdown
Contributor

(Even if it can be done by modifying something in the source code, I'm fine doing that in my local SH source.)

@mvoidex
Copy link
Copy Markdown
Member Author

mvoidex commented Mar 23, 2018

Uploaded hsdev-0.3.1.3 with flag --no-color to disable colorized output

@moodmosaic
Copy link
Copy Markdown
Contributor

Anyone seen this?

With the latest commits that are merged from master into this branch (hsdev-3), hdocs aren't working, unless I go manually and revert 54259e5.

Is this still the case? I'm a bit scared to just pull the latest.

@moodmosaic
Copy link
Copy Markdown
Contributor

OK, I pulled the latest from hsdev-3 and everything seems to work fine regarding #386 (comment).

@mvoidex
Copy link
Copy Markdown
Member Author

mvoidex commented Mar 26, 2018

@bscottm do you have any suggestions, what should be done here before merge?
Right now I have no plans to modify hsdev, so it's somehow stable now.
I'm using this branch and it seems to work for me.

It's not backward compatible now. I understand that it's not good to force users to use new hsdev version, but I'm not sure if I can find enough time to support both versions.

@moodmosaic
Copy link
Copy Markdown
Contributor

Works fine for me too. It's fine to force users to upgrade to the same major version of hsdev, according to https://semver.org.

Perhaps, it's also a good chance to mention SemVer 2.0 on the README as well, if you guys follow it.

@mvoidex
Copy link
Copy Markdown
Member Author

mvoidex commented Mar 26, 2018

I'm trying to follow https://pvp.haskell.org/
The main difference is that according to PVP major version is X.Y part instead of X (where version is X.Y.Z).

@moodmosaic
Copy link
Copy Markdown
Contributor

Even better, then.

B. Scott Michel added 5 commits April 17, 2018 12:21
mvoidex added several new methods to the hsdev backend, which were not
added to the HaskellBackend base class. Sync with hsdev's current
method list.
Ensure that we don't go through the on_query_completions logic when
the view's source isn't Haskell. Otherwise, we potentially interfere
with other completion generators.

Create a default implementation function generator for backend methods
that don't do anything except dispatch an empty list. Cuts down on the
overall complexity of the code.
Fixed the method parameters for a lot of backend functions where hsdev
changed the parameters.

A few places where lines were too long, needed simplification on
expressions.
Added specific diagnostic output for the build.py build system
("build_system" in component_debug setting), the aysnc worker thread
("util_worker" in component_debug).

Trying to track down why the `complete` hsdev backend command freezes.
1. Add additional wrapper arguments so that different 'stack.yaml'
   configurations can be specified when starting hsdev. This alleviates
   the problem when the user's project uses 8.0.2 and needs a hsdev
   compiled with 8.0.2.

2. Color schemes now have comments in them. Don't load them using the
   JSON string loader; prefer the Sublime resource loader instead.

3. Make sure that the 'docs' scan actually does its scan, even if hsdev
   says that it's not supported/implemented.
@juanmbellini
Copy link
Copy Markdown

Any news about this?

@mvoidex
Copy link
Copy Markdown
Member Author

mvoidex commented Aug 15, 2018

@juanmbellini I was out of process for a long time and not sure if we can safely merge it

I've updated hsdev and going to upload new version compatible with current stackage LTS
There's also hsdev-0.3.2.0 branch for new hsdev version.

Check & lint works for me, but there's something wrong with autocompletion. hsdev returns correct completions, but SublimeHaskell doesn't show them. I'll try to fix it as soon as possible and update branch.

@mvoidex
Copy link
Copy Markdown
Member Author

mvoidex commented Aug 15, 2018

Completions fixed: de5610f

The backend `call` function can return boolean True or False, where a list is
expected in normal circumstances. This can happen, for example, if the hsdev
process is killed. In such cases, the involved functions raise a TypeError.

This behaviour can be seen in the on-hover and completions handlers, upon
killing the hsdev process.
@mvoidex
Copy link
Copy Markdown
Member Author

mvoidex commented Oct 9, 2018

Closing in favor of #429

@mvoidex mvoidex closed this Oct 9, 2018
@mvoidex mvoidex deleted the hsdev-3 branch July 28, 2019 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants