Skip to content
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

Fix #113 + tabs to spaces #114

Closed
wants to merge 5 commits into from
Closed

Fix #113 + tabs to spaces #114

wants to merge 5 commits into from

Conversation

srghma
Copy link

@srghma srghma commented Oct 19, 2017

so i basically copied logic from getType and substituted filters based on imports with only currentModule

Copy link
Collaborator

@coot coot left a comment

Choose a reason for hiding this comment

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

For the style settings what vim settings are you using? I have noexpandtab (which is vim default) and incosistently I use softtabstop=2 (the default is 0) and shiftwidth=2). The problem is how the line continuation \ is indented by the default vim indent script. Even with expandtab I end up with 6 spaces that are inserted. I prefer to stay close to how vim works to avoid manual indentation.

\ && cwdresp2Decoded.result == a:expectedCWD
call purescript#ide#utils#debug("s:retryFn: success", 1)
call PSCIDEload(1, "")
else
if type(cwdresp2Decoded) == v:t_dict
let error = get(cwdresp2Decoded, "error", [])
if type(error) == v:t_list && len(error) && !silent
call purescript#ide#utils#warn(join(error, " "), v:true)
call purescript#ide#utils#warn(join(error, " "), v:true)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you fix indentation here.


if a:isRetry
if !silent
call purescript#ide#utils#log("failed to contact server", v:true)
call purescript#ide#utils#log("failed to contact server", v:true)
Copy link
Collaborator

Choose a reason for hiding this comment

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

and here as well.

if type(a:resp) != v:t_dict || get(a:resp, "resultType", "error") !=# "success"
if !a:silent && type(a:resp) == v:t_dict
return purescript#ide#utils#log(a:resp["result"])
return purescript#ide#utils#log(a:resp["result"])
Copy link
Collaborator

Choose a reason for hiding this comment

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

and here

@@ -140,16 +140,16 @@ function! s:callback(resp, ident, view, lines, silent, rebuild, ignoreMultiple,
let results = []
for res in respResults
if empty(filter(copy(results), { idx, val -> val.module == res.module }))
call add(results, res)
call add(results, res)
Copy link
Collaborator

Choose a reason for hiding this comment

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

and here

endif
endfor
if (len(results) == 1)
let choice = { "option": results[0], "picked": v:true }
else
if !a:ignoreMultiple
let choice = purescript#ide#utils#pickOption("Multiple possibilities to import " . a:ident, results, "module")
let choice = purescript#ide#utils#pickOption("Multiple possibilities to import " . a:ident, results, "module")
Copy link
Collaborator

Choose a reason for hiding this comment

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

and these two lines too

else
return
return
Copy link
Collaborator

Choose a reason for hiding this comment

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

and here

\ a:ident,
\ v:true,
\ { resp -> s:PSCIDEaddTypeAnnotationCallback(a:ident, resp) }
let currentModule = purescript#ide#utils#currentModule()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not just change s:getType. This will also fix Ptype command.

Copy link
Author

Choose a reason for hiding this comment

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

How? add to s:getType new parameter with meaning use currentModule as only filter?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it would be just enough to add the currentModule to the modules list here

@srghma
Copy link
Author

srghma commented Oct 22, 2017

@coot, I have fixed tabs, nice catch

My settings in vim:
tabstop=2 shiftwidth=2 softtabstop=2 expandtab smarttab

@coot
Copy link
Collaborator

coot commented Oct 22, 2017

Do you use some plugin for indentation? The default indentexpr will not work the way you indented the code.

@srghma
Copy link
Author

srghma commented Oct 22, 2017

@coot I think editorconfig
But whats the matter? Something wrong with indentation?

@coot
Copy link
Collaborator

coot commented Oct 22, 2017

As I mentioned, I don't want to manually indent every \ line continuation, I prefer to stay with vim's default unless it can be easily altered. I don't like the default indentation too much, but it just convenient to have indetation that just works without extra plugins (least common denominator).

@srghma
Copy link
Author

srghma commented Oct 22, 2017

Ah, I got it, \ adds 6 spaces to previous indentation and it is inconsistent with the one that I have done

before - https://asciinema.org/a/FpwjjbySPPmDMuQblLsHvVkP8

fixed this with :%s:\ \ \\:\ \ \ \ \ \ \\:g everywhere except autoload/purescript/job.vim

now - https://asciinema.org/a/qZVseux12XvUUcCHmPGot9Fhm

@coot
Copy link
Collaborator

coot commented Oct 22, 2017

Thanks!

@coot
Copy link
Collaborator

coot commented Dec 15, 2017

#113 is fixed now.

@coot coot closed this Dec 15, 2017
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.

3 participants